/* 错题工作台 — 响应式样式（移动优先；断点 768 / 1280） */
:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #4f6df5;
  --primary-dark: #3b55d9;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --border: #e5e7eb;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  padding-bottom: 64px; /* 移动端 tabbar */
}

a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px;
}
.brand { font-weight: 700; font-size: 17px; color: var(--text); white-space: nowrap; }
.nav { display: none; gap: 4px; flex: 1; }
.nav a {
  padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 500;
}
.nav a.active { background: #eef2ff; color: var(--primary); }
.userbox { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.userbox button {
  border: 1px solid var(--border); background: #fff; border-radius: 8px;
  padding: 4px 10px; font-size: 12px; color: var(--muted);
}

/* 移动端底部 tab */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; background: var(--card);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 8px 0 6px; font-size: 18px; color: var(--muted);
}
.tabbar a span { font-size: 11px; }
.tabbar a.active { color: var(--primary); }

@media (min-width: 768px) {
  body { padding-bottom: 0; }
  .nav { display: flex; }
  .tabbar { display: none; }
}

/* ---------- 布局 ---------- */
.app {
  max-width: 1200px; margin: 0 auto;
  padding: 16px;
}
.section-title {
  font-size: 16px; font-weight: 700; margin: 20px 0 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.section-title .more { font-size: 13px; font-weight: 400; }

.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px; border: 1px solid var(--border);
}

/* 指标卡：移动端 2×2，PC 一行 4 张 */
.stat-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
}
@media (min-width: 768px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow); cursor: pointer;
}
.stat-card .num { font-size: 26px; font-weight: 700; line-height: 1.2; }
.stat-card .label { color: var(--muted); font-size: 12px; margin-top: 2px; }
.stat-card.primary .num { color: var(--primary); }
.stat-card.warn .num { color: var(--amber); }
.stat-card.good .num { color: var(--green); }

/* 快捷入口 */
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.quick-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 16px 8px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--card); box-shadow: var(--shadow); font-size: 14px; font-weight: 600;
  color: var(--text);
}
.quick-btn .icon { font-size: 22px; }
.quick-btn:hover { border-color: var(--primary); color: var(--primary); }

/* 双栏（PC） */
.cols { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 1280px) {
  .cols { grid-template-columns: 1fr 1fr; }
  .cols-3-2 { grid-template-columns: 3fr 2fr; }
}

/* 表格 → 移动端卡片 */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th, table.list td {
  text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top;
}
table.list th { color: var(--muted); font-weight: 500; font-size: 12px; white-space: nowrap; }
@media (max-width: 767px) {
  table.list thead { display: none; }
  table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
  table.list tr {
    border: 1px solid var(--border); border-radius: var(--radius);
    margin-bottom: 10px; padding: 8px 12px; background: var(--card);
  }
  table.list td { border: none; padding: 3px 0; }
  table.list td::before {
    content: attr(data-label) "："; color: var(--muted); font-size: 12px;
  }
}

/* 标签 */
.tag {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; background: #eef2ff; color: var(--primary); margin: 1px 2px;
}
.tag.gray { background: #f3f4f6; color: var(--muted); }
.tag.green { background: #dcfce7; color: var(--green); }
.tag.red { background: #fee2e2; color: var(--red); }
.tag.amber { background: #fef3c7; color: var(--amber); }

/* 表单 */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field input[type="text"], .field input[type="password"], .field textarea, .field select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 15px; font-family: inherit; background: #fff; color: var(--text);
}
.field textarea { min-height: 96px; resize: vertical; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
.row-2 { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 768px) { .row-2 { grid-template-columns: 1fr 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 10px; padding: 10px 18px; font-size: 15px; font-weight: 600;
  background: var(--primary); color: #fff; min-height: 44px;
}
.btn:hover { background: var(--primary-dark); }
.btn.secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: var(--red); }
.btn.ghost { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }

/* 确认卡 */
.confirm-card {
  border: 2px solid var(--primary); border-radius: var(--radius);
  padding: 16px; background: #f8faff; margin-top: 14px;
}
.confirm-card h3 { margin: 0 0 10px; font-size: 15px; }

/* 复习 / 练习流 */
.practice-stem {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; font-size: 17px; line-height: 1.8; white-space: pre-wrap;
}
.practice-result {
  margin-top: 12px; padding: 14px 16px; border-radius: var(--radius); font-weight: 600;
}
.practice-result.ok { background: #dcfce7; color: var(--green); }
.practice-result.bad { background: #fee2e2; color: var(--red); }

/* 图表 */
.chart { width: 100%; overflow-x: auto; }
.chart svg { display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; }

/* 弱项列表 */
.weak-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--border); cursor: pointer; flex-wrap: wrap;
}
.weak-item:last-child { border-bottom: none; }
.weak-item .name { font-weight: 600; min-width: 110px; }
.weak-item .bar-wrap { flex: 1; min-width: 80px; background: #f3f4f6; height: 8px; border-radius: 999px; overflow: hidden; }
.weak-item .bar { height: 100%; background: var(--amber); border-radius: 999px; }
.weak-item .meta { color: var(--muted); font-size: 12px; white-space: normal; text-align: right; flex: 1 1 100%; }
@media (min-width: 768px) {
  .weak-item .meta { flex: 0 1 auto; white-space: nowrap; }
}

/* 登录 */
.login-wrap {
  min-height: 70vh; display: flex; align-items: center; justify-content: center;
}
.login-card { width: 100%; max-width: 380px; }

/* 空态 */
.empty { text-align: center; color: var(--muted); padding: 36px 12px; }
.empty .big { font-size: 40px; margin-bottom: 8px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%) translateY(20px);
  background: #111827; color: #fff; padding: 10px 18px; border-radius: 10px;
  opacity: 0; pointer-events: none; transition: all 0.25s; z-index: 100; max-width: 86vw;
  font-size: 14px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (min-width: 768px) { .toast { bottom: 32px; } }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
