:root {
  --brand: #c0392b;
  --brand2: #2980b9;
  --ink: #222;
  --muted: #777;
  --line: #e6e6e6;
  --bg: #f4f6f9;
  --card: #fff;
  --ok: #27ae60;
  --warn: #f39c12;
  --bad: #e74c3c;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.6;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #c0392b 0%, #2980b9 100%);
}
.login-card {
  width: 360px; background: #fff; border-radius: 14px; padding: 36px 30px;
  box-shadow: 0 18px 50px rgba(0,0,0,.22);
}
.login-card h1 { font-size: 22px; margin: 0 0 4px; color: var(--brand); }
.login-card .sub { color: var(--muted); margin-bottom: 22px; font-size: 13px; }
.login-card label { display: block; font-size: 13px; color: #444; margin: 12px 0 6px; }
.login-card input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; outline: none;
}
.login-card input:focus { border-color: var(--brand2); }
.btn {
  display: inline-block; padding: 10px 18px; border: none; border-radius: 8px;
  background: var(--brand); color: #fff; font-size: 14px; transition: .15s;
}
.btn:hover { opacity: .92; }
.btn.block { width: 100%; margin-top: 22px; padding: 12px; font-size: 15px; }
.btn.ghost { background: #fff; color: var(--brand2); border: 1px solid var(--brand2); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.gray { background: #eee; color: #444; }
.login-tip { margin-top: 14px; font-size: 12px; color: var(--muted); text-align: center; }

/* ---------- 主框架 ---------- */
.topbar {
  height: 56px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; padding: 0 20px; gap: 12px;
}
.topbar .logo { font-weight: 700; color: var(--brand); font-size: 18px; }
.topbar .title { color: #555; font-size: 14px; }
.topbar .spacer { flex: 1; }
.topbar .acc { color: #555; font-size: 13px; }
.layout { display: flex; min-height: calc(100vh - 56px); }
.sidebar { width: 180px; background: #fff; border-right: 1px solid var(--line); padding: 14px 10px; }
.sidebar button {
  display: block; width: 100%; text-align: left; padding: 11px 14px; margin-bottom: 6px;
  border: none; background: transparent; color: #444; border-radius: 8px; font-size: 14px;
}
.sidebar button:hover { background: #f2f5fa; }
.sidebar button.active { background: var(--brand); color: #fff; }
.content { flex: 1; padding: 22px; overflow: auto; }
.view-title { font-size: 18px; margin: 0 0 16px; }

/* ---------- 卡片/表单 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-bottom: 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid4 { display: grid; grid-template-columns: 1.2fr 1fr .8fr auto; gap: 12px; align-items: end; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: #444; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; outline: none;
}
.field input:focus, .field select:focus { border-color: var(--brand2); }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.step-bar { display: flex; gap: 8px; margin-bottom: 18px; }
.step-bar .step { flex: 1; text-align: center; padding: 8px; border-radius: 8px; background: #fff; border: 1px solid var(--line); font-size: 13px; color: #888; }
.step-bar .step.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.step-bar .step.done { background: #eaf6ee; color: var(--ok); border-color: #bfe3cc; }

/* ---------- 成绩录入表 ---------- */
.score-table { width: 100%; border-collapse: collapse; }
.score-table th, .score-table td { border: 1px solid var(--line); padding: 8px 10px; text-align: center; font-size: 13px; }
.score-table th { background: #f7f9fc; color: #555; }
.score-table input { width: 78px; padding: 6px; text-align: center; border: 1px solid var(--line); border-radius: 6px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.tag.weak { background: #fdecea; color: var(--bad); }
.tag.medium { background: #fef5e7; color: var(--warn); }
.tag.strong { background: #eafaf1; color: var(--ok); }

/* ---------- 方案卡片 ---------- */
.plan-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.plan-card { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: #fff; position: relative; }
.plan-card.large { border-color: #8e44ad; box-shadow: 0 6px 20px rgba(142,68,173,.12); }
.plan-card.medium { border-color: var(--brand2); }
.plan-card.small { border-color: var(--ok); }
.plan-card h3 { margin: 0 0 4px; font-size: 16px; }
.plan-card .tagline { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.plan-card .metric { display: flex; justify-content: space-between; font-size: 13px; padding: 5px 0; border-bottom: 1px dashed #eee; }
.plan-card .metric b { color: var(--ink); }

/* ---------- 辅导科目选择 ---------- */
.subj-picker { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 6px; }
.subj-check {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px;
  background: #fff; font-size: 13px; cursor: pointer; user-select: none;
}
.subj-check:hover { border-color: var(--brand2); background: #f6fafd; }
.subj-check input { width: 15px; height: 15px; margin: 0; }

/* ---------- 记录列表 ---------- */
.rec-item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: #fff; margin-bottom: 12px; }
.rec-item .meta { flex: 1; }
.rec-item .meta .nm { font-weight: 600; }
.rec-item .meta .sub { font-size: 12px; color: var(--muted); }

/* ---------- 知识库树 ---------- */
.kb-tree { font-size: 13px; }
.kb-tree .sbj { font-weight: 600; margin: 10px 0 4px; color: var(--brand); }
.kb-tree .ch { padding-left: 14px; color: #555; }
.kb-tree .pt { padding-left: 28px; color: #666; font-size: 12px; }
.kb-tree .pt .tp { font-size: 11px; padding: 1px 6px; border-radius: 8px; margin-left: 6px; }
.tp.基础 { background: #eafaf1; color: var(--ok); }
.tp.核心 { background: #eaf2fb; color: var(--brand2); }
.tp.拔高 { background: #f3e9f8; color: #8e44ad; }
.tp.深化 { background: #fdf3e2; color: #b9770e; }
.tp.训练 { background: #f2f4f6; color: #7f8c8d; }
.ses .tp { font-size: 10px; padding: 0 5px; border-radius: 7px; margin-left: 4px; }

/* ---------- 报告（屏幕预览 + 打印；793px ≈ A4 210mm @96dpi） ---------- */
#report-root { background: #f0f2f5; padding: 20px 0; }
.report-page {
  width: 793px; margin: 0 auto 22px; background: #fff; padding: 0;
  position: relative; overflow: hidden; box-shadow: 0 2px 14px rgba(0,0,0,.13);
  font-size: 13.5px; line-height: 1.75; color: #2b2b2b;
  min-height: 1122px; break-inside: avoid; page-break-inside: avoid;
  break-after: page; page-break-after: always;
}
.rp-body { padding: 44px 52px 74px 52px; }
/* 分页测量容器（离屏，不显示） */
.rp-probe {
  position: absolute; left: -99999px; top: 0; visibility: hidden;
  display: flow-root; font-size: 13.5px; line-height: 1.75; color: #2b2b2b;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}
/* 封面：精确占满一张 A4（793 × 1122） */
.report-page.cover {
  background: linear-gradient(155deg, #b02f24 0%, #2b6cb0 100%);
  color: #fff; padding: 0;
  display: flex; flex-direction: column; justify-content: space-between;
}
.report-page.cover > div:first-child { padding: 74px 64px 0; }
.report-page.cover > div:last-child { padding: 0 64px 64px; }
.report-page > *:not(.watermark) { position: relative; z-index: 1; }
.contact-foot {
  position: absolute; left: 52px; right: 52px; bottom: 44px;
  margin-top: 0 !important; font-size: 11px; color: #8a8a8a;
}
.report-page.cover .org { font-size: 22px; letter-spacing: 3px; opacity: .96; font-weight: 600; }
.report-page.cover .org-sub { font-size: 13px; letter-spacing: 2px; opacity: .75; margin-top: 6px; }
.report-page.cover .big { font-size: 46px; font-weight: 800; margin: 30px 0 6px; letter-spacing: 6px; line-height: 1.25; }
.report-page.cover .divider { width: 120px; height: 3px; background: rgba(255,255,255,.7); margin: 20px 0 26px; }
.report-page.cover .stu { font-size: 17px; opacity: .92; line-height: 2.1; }
.report-page.cover .stu b { font-size: 27px; letter-spacing: 1px; }
.report-page.cover .foot {
  font-size: 13px; opacity: .9; line-height: 2; border-top: 1px solid rgba(255,255,255,.35); padding-top: 18px;
}
.report-h {
  font-size: 19px; font-weight: 700; margin: 26px 0 14px; color: #1f2d3d;
  border-left: 5px solid var(--brand); padding: 4px 0 4px 11px; background: #fafbfd;
}
.report-h:first-child { margin-top: 0; }
.report-sub { font-size: 13.5px; color: #444; margin: 9px 0; }
.kpi-row { display: flex; gap: 12px; margin: 14px 0; break-inside: avoid; page-break-inside: avoid; }
.kpi {
  flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 13px 8px;
  text-align: center; background: #fcfdff;
}
.kpi .v { font-size: 21px; font-weight: 700; color: var(--brand); line-height: 1.3; }
.kpi .l { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.tbl { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 12.5px; }
.tbl th, .tbl td { border: 1px solid #d8dee8; padding: 7px 9px; }
.tbl th { background: #eef3fa; color: #26374d; font-weight: 600; }
.tbl tr:nth-child(even) td { background: #fafbfd; }
.tbl tr { break-inside: avoid; page-break-inside: avoid; }
.sched-week {
  margin: 10px 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
  break-inside: avoid; page-break-inside: avoid;
}
.sched-week .wk { background: #eef3fa; padding: 8px 12px; font-weight: 600; font-size: 13px; border-bottom: 1px solid var(--line); }
.sched-week .ses { padding: 7px 12px; border-top: 1px solid #f0f0f0; font-size: 12.5px; line-height: 1.7; }
.sched-week .ses:first-child { border-top: none; }
.note-box {
  background: #fbf6ec; border: 1px solid #f0e0c0; border-radius: 8px;
  padding: 12px 14px; font-size: 12.5px; color: #6b5530; line-height: 1.8;
  break-inside: avoid; page-break-inside: avoid;
}
.watermark {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0;
  display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 30px 60px;
  opacity: .05; transform: rotate(-28deg); font-size: 26px; font-weight: 700; color: #000;
}
.report-page > *:not(.watermark) { position: relative; z-index: 1; }
.papers { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.papers img { max-width: 180px; max-height: 220px; border: 1px solid var(--line); border-radius: 6px; }
/* 图表容器：避免被截断 */
.report-page svg { display: block; margin: 6px 0; break-inside: avoid; page-break-inside: avoid; }

.report-actions { margin-bottom: 16px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- 浏览器 PDF 导出时去掉多余样式 ---------- */
.exporting .report-page { box-shadow: none !important; }
.exporting .preview-bar, .exporting .no-print { display: none !important; }

/* ---------- 报告预览悬浮操作条（不打印） ---------- */
.preview-bar {
  position: fixed; top: 12px; right: 16px; z-index: 500;
  background: #333; color: #fff; border-radius: 10px; padding: 8px 12px;
  display: flex; gap: 8px; align-items: center; font-size: 13px;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.preview-bar button { background: #fff; color: #333; border: none; border-radius: 6px; padding: 5px 10px; font-size: 12px; }
.preview-bar button.primary { background: var(--brand); color: #fff; }

/* ---------- 辅导科目选择器 ---------- */
.subj-picker { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.subj-check {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 11px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; font-size: 13px; cursor: pointer; user-select: none;
}
.subj-check:hover { border-color: var(--brand2); }
.subj-check input { margin: 0; }
.subj-check .tag { padding: 1px 6px; border-radius: 6px; font-size: 11px; }

/* ---------- 考点结构环形图网格 ---------- */
.dn-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.dn-cell {
  flex: 1 1 320px; min-width: 300px; max-width: 100%;
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px 2px;
  background: #fff; break-inside: avoid; page-break-inside: avoid;
}
.dn-cell .dn-t { font-size: 12px; font-weight: 600; color: #444; margin-bottom: 2px; }
.dn-cell svg { margin: 0; }

/* ---------- 页脚（机构 + 员工联系方式 + 三校区） ---------- */
.contact-foot .cf-row { display: flex; align-items: center; }
.contact-foot .cf-top {
  gap: 14px; font-size: 11px; color: #8a8a8a;
  border-top: 1px solid var(--line); padding-top: 8px;
}
.contact-foot .cf-brand { font-weight: 700; color: var(--brand); font-size: 12px; letter-spacing: .5px; }
.contact-foot .cf-item i { font-style: normal; color: #b0b0b0; margin-right: 4px; }
.contact-foot .cf-item b { color: #555; font-weight: 700; }
.contact-foot .cf-site { margin-left: auto; }
.contact-foot .cf-campuses {
  margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line);
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  font-size: 10.5px; color: #9a9a9a; line-height: 1.5;
}
.contact-foot .cf-campus b {
  display: inline-block; color: #7a7a7a; font-weight: 700; margin-right: 5px;
}
.contact-foot .cf-campus + .cf-campus { border-left: 1px solid #eee; padding-left: 10px; }

/* ---------- 方案总结 ---------- */
.summary-para p {
  margin: 0 0 10px; font-size: 13px; line-height: 1.9; color: #333; text-align: justify;
}
.summary-para p:last-child { margin-bottom: 0; }
.sum-steps {
  margin-top: 14px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.sum-step {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  background: #fcfcfd; font-size: 12px; color: #666; line-height: 1.7;
  break-inside: avoid; page-break-inside: avoid;
}
.sum-step b { display: block; color: var(--brand2); font-size: 13px; margin-bottom: 4px; }

/* ---------- 云端后台：员工 / 方案存档 ---------- */
.cloud-note {
  background: #fbfcfe; border: 1px dashed var(--line); border-radius: 8px;
  padding: 10px 12px; font-size: 12.5px; color: #777; margin-bottom: 12px;
}
.cloud-bad {
  background: #fdf3f2; border-color: #f3d2ce; color: #b0392c;
}
.login-row { display: flex; gap: 8px; }
.login-row input { flex: 1; }
.login-row .btn { flex: 0 0 auto; white-space: nowrap; padding: 10px 12px; }
.login-tabs {
  display: flex; gap: 6px; margin-bottom: 14px; border-bottom: 1px solid var(--line);
}
.login-tabs button {
  flex: 1; padding: 9px 0; border: none; background: transparent; font-size: 14px;
  color: #888; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.login-tabs button.active { color: var(--brand); font-weight: 600; border-bottom-color: var(--brand); }
.staff-badge {
  display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px;
  background: #eef4fb; color: var(--brand2);
}
.staff-badge.admin { background: #fdeeeb; color: var(--brand); }
.staff-badge.off { background: #f0f0f0; color: #999; }

/* ---------- 打印 ---------- */
@page { size: A4; margin: 0; }
@media print {
  body { background: #fff; }
  .login-wrap, .topbar, .sidebar, .content, .report-actions, #app,
  .preview-bar, .no-print, .rp-probe { display: none !important; }
  #report-root { display: block !important; padding: 0; background: #fff; }
  /* 关键：打印时的盒模型必须与屏幕测量时完全一致，否则分页会错版 */
  .report-page {
    width: 793px; margin: 0; box-shadow: none; padding: 0;
    position: relative; overflow: hidden;
    break-after: page; page-break-after: always;
  }
  .report-page .rp-body { padding: 44px 52px 74px 52px; }
  .report-page.cover { padding: 0; }
  .watermark { opacity: .05; }
}
