/* ============================================================
   贤举书院全科作业批改系统 - 全局样式（移动优先）
   ============================================================ */
:root {
  --primary: #2f6db3;
  --primary-dark: #1f4d82;
  --primary-light: #eaf2fb;
  --green: #1e9e5a;
  --red: #d64545;
  --orange: #e08a2e;
  --gray: #8a94a6;
  --bg: #f4f6fa;
  --card: #ffffff;
  --border: #e3e8f0;
  --text: #1f2733;
  --text-2: #5a6678;
  --radius: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; }
input, select, textarea {
  font: inherit;
  color: inherit;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
textarea { min-height: 64px; resize: vertical; }
label { display: block; font-size: 13.5px; color: var(--text-2); margin-bottom: 6px; }

/* ---------- 布局 ---------- */
.page { max-width: 560px; margin: 0 auto; padding: 14px 14px 80px; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--primary); color: #fff;
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
}
.topbar .title { font-size: 16px; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar a { color: #fff; font-size: 14px; }
.topbar .back { font-size: 20px; line-height: 1; padding: 2px 6px; }
.topbar .user { font-size: 12.5px; opacity: .9; }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  background: #fff; border-top: 1px solid var(--border);
  display: flex; max-width: 560px; margin: 0 auto;
}
.bottom-nav a {
  flex: 1; text-align: center; padding: 8px 2px 10px;
  color: var(--gray); font-size: 11px;
}
.bottom-nav a.active { color: var(--primary); font-weight: 600; }
.bottom-nav .ico { display: block; font-size: 18px; line-height: 1.3; }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; border: 1px solid var(--border); }
.card h3 { font-size: 15.5px; margin-bottom: 10px; }
.card .muted { color: var(--gray); font-size: 12.5px; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.stat-box { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; text-align: center; }
.stat-box .num { font-size: 26px; font-weight: 700; color: var(--primary); }
.stat-box .label { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 18px;
  border-radius: 10px; border: none; cursor: pointer;
  font-size: 15px; font-weight: 500; text-align: center;
  background: var(--primary); color: #fff; width: 100%;
}
.btn:hover { background: var(--primary-dark); }
.btn.small { min-height: 34px; padding: 4px 12px; font-size: 13px; width: auto; border-radius: 8px; }
.btn.gray { background: #eef1f6; color: var(--text); }
.btn.gray:hover { background: #dfe4ec; }
.btn.green { background: var(--green); }
.btn.red { background: var(--red); }
.btn.orange { background: var(--orange); }
.btn.outline { background: #fff; border: 1px solid var(--primary); color: var(--primary); }
.btn.outline:hover { background: var(--primary-light); }
.btn-row { display: flex; gap: 10px; margin-top: 14px; }
.btn-row .btn { flex: 1; }

/* ---------- 表单 ---------- */
.form-item { margin-bottom: 14px; }
.form-item .help { font-size: 12px; color: var(--gray); margin-top: 4px; }
.check-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.check-item {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
  background: #fff; cursor: pointer; font-size: 14px;
}
.check-item input { width: auto; }
.check-item.on { border-color: var(--primary); background: var(--primary-light); }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper input { text-align: center; flex: 1; }
.stepper button { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--border); background: #fff; font-size: 20px; cursor: pointer; flex: 0 0 44px; }
.stepper button:active { background: var(--primary-light); }

/* ---------- 列表 ---------- */
.list-item {
  display: block; background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; margin-bottom: 10px;
}
.list-item .row1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.list-item .name { font-size: 15px; font-weight: 600; }
.list-item .meta { font-size: 12.5px; color: var(--text-2); margin-top: 4px; line-height: 1.7; }
.list-item .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- 标签 ---------- */
.tag { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.tag.green { background: #e3f5ea; color: var(--green); }
.tag.red { background: #fde8e8; color: var(--red); }
.tag.orange { background: #fdf0df; color: var(--orange); }
.tag.blue { background: var(--primary-light); color: var(--primary); }
.tag.gray { background: #eef1f6; color: var(--text-2); }

/* ---------- 题目块 ---------- */
.q-block { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.q-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.q-content { font-size: 14.5px; white-space: pre-wrap; word-break: break-word; }
.q-answer { background: var(--bg); border-radius: 10px; padding: 10px 12px; margin-top: 8px; font-size: 13.5px; }
.q-answer .lbl { color: var(--gray); font-size: 12px; }
.q-analysis { border-left: 3px solid var(--primary); background: var(--primary-light); padding: 8px 12px; margin-top: 8px; font-size: 13px; border-radius: 0 8px 8px 0; }

/* ---------- 筛选条 ---------- */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filter-bar select, .filter-bar input { width: auto; flex: 1 1 30%; min-width: 90px; padding: 8px 10px; font-size: 13px; }

/* ---------- 提示 ---------- */
.flash-wrap { max-width: 560px; margin: 0 auto; padding: 10px 14px 0; }
.alert { padding: 10px 14px; border-radius: 10px; margin-bottom: 8px; font-size: 13.5px; }
.alert.success { background: #e3f5ea; color: var(--green); }
.alert.danger { background: #fde8e8; color: var(--red); }
.alert.warning { background: #fdf0df; color: var(--orange); }

/* ---------- 图片 ---------- */
.img-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.img-grid img { width: 100%; border-radius: 8px; border: 1px solid var(--border); background: #fff; }

/* ---------- 表格（管理后台/打印） ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; background: #fff; }
.tbl th { background: #f0f3f8; padding: 9px 10px; text-align: left; font-weight: 600; white-space: nowrap; }
.tbl td { padding: 9px 10px; border-top: 1px solid var(--border); vertical-align: top; word-break: break-word; }
.tbl tr:hover td { background: #fafbfd; }

/* ---------- 图表 ---------- */
.chart-box { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.chart-box h4 { font-size: 14px; margin-bottom: 8px; }
.chart-box canvas { width: 100%; }

/* ---------- 打印 ---------- */
.print-only { display: none; }
@media print {
  .no-print { display: none !important; }
  .print-only { display: block; }
  body { background: #fff; }
  .page { padding: 0; max-width: none; }
  .q-block { break-inside: avoid; border: 1px solid #ccc; }
  .answer-mask { color: transparent; }
}
