/* Thesis Format Lab V0.1 — 浅色主题 */
:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --ink: #1f2937;
  --ink-2: #6b7280;
  --line: #e5e7eb;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn: #d97706;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 14px rgba(15, 23, 42, .06);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 14px; line-height: 1.6;
}
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 28px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 10px; background: var(--primary);
  color: #fff; font-weight: 700; font-size: 16px; display: flex; align-items: center; justify-content: center;
}
.brand h1 { margin: 0; font-size: 17px; }
.brand .sub { margin: 0; font-size: 12px; color: var(--ink-2); }
.privacy-badge { font-size: 12px; color: var(--ok); background: #ecfdf5; border: 1px solid #a7f3d0; padding: 6px 12px; border-radius: 999px; }
main { max-width: 980px; margin: 24px auto; padding: 0 20px; }
.view { display: block; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 26px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 14px; font-size: 15px; }
.divider { text-align: center; color: var(--ink-2); margin: 12px 0; font-size: 12px; }
.divider span { padding: 0 10px; }
.tpl-select { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tpl-select select { flex: 1; min-width: 260px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 14px; }
.tpl-upload { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.hint { color: var(--ink-2); font-size: 12px; }
.tip { color: var(--warn); font-size: 12px; margin: 8px 0 12px; }
.warn-box, .error-box { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-top: 12px; }
.error-box { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.dropzone {
  border: 2px dashed #cbd5e1; border-radius: var(--radius); padding: 34px 20px; text-align: center;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: #eff6ff; }
.dz-main { font-size: 15px; margin: 0 0 4px; }
.dz-sub { color: var(--ink-2); font-size: 12px; margin: 0; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.btn {
  border: none; border-radius: 8px; padding: 9px 20px; font-size: 14px; cursor: pointer;
  transition: filter .15s, background .15s; font-family: inherit;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: #eff6ff; }
.btn-ghost { background: transparent; color: var(--ink-2); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--bg); }

/* 结果页 */
.result-card .score-wrap { display: flex; gap: 28px; align-items: center; }
.score-ring {
  width: 128px; height: 128px; border-radius: 50%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; background: conic-gradient(var(--primary) calc(var(--p) * 1%), #e8edf4 0);
  position: relative; flex-shrink: 0;
}
.score-ring::before { content: ""; position: absolute; inset: 10px; background: #fff; border-radius: 50%; }
.score-ring span, .score-ring small { position: relative; }
.score-ring span { font-size: 40px; font-weight: 700; color: var(--primary); line-height: 1; }
.score-ring small { color: var(--ink-2); margin-top: 2px; }
.score-side h2 { margin: 0 0 6px; }
.issue-count { font-size: 16px; font-weight: 600; margin: 0 0 4px; }
.cats { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.cat-chip {
  display: flex; flex-direction: column; align-items: center; min-width: 84px;
  background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px;
}
.cat-chip .num { font-size: 22px; font-weight: 700; }
.cat-chip .lab { font-size: 12px; color: var(--ink-2); }
.cat-chip.zero .num { color: var(--ok); }
.cat-chip.warn .num { color: var(--danger); }
.cat-chip.manual .num { color: var(--warn); }

/* 问题列表 */
.issue-group { margin-bottom: 18px; }
.issue-group h3 { font-size: 13px; margin: 0 0 8px; color: var(--ink-2); }
.issue-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin-bottom: 10px; }
.issue-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.badge { font-size: 11px; padding: 2px 9px; border-radius: 999px; font-weight: 600; }
.badge.cat { background: #eff6ff; color: var(--primary-dark); }
.badge.fix { background: #fef2f2; color: var(--danger); }
.badge.ok { background: #ecfdf5; color: var(--ok); }
.badge.manual { background: #fff7ed; color: var(--warn); }
.badge.unknown { background: #f3f4f6; color: var(--ink-2); }
.para-text { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 120px; }
.diff-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.diff-table th, .diff-table td { border: 1px solid var(--line); padding: 5px 10px; text-align: left; }
.diff-table th { background: #f8fafc; font-weight: 600; width: 90px; color: var(--ink-2); }
.diff-table .cur { color: var(--danger); }
.diff-table .req { color: var(--ok); font-weight: 600; }
.arrow { color: var(--ink-2); padding: 0 6px; }

/* 报告 */
.report-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.report-cell { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 12px; text-align: center; }
.report-cell .n { font-size: 22px; font-weight: 700; }
.report-cell .l { font-size: 12px; color: var(--ink-2); }
.report-detail { font-size: 13px; }
.report-detail .row { display: flex; gap: 8px; padding: 3px 0; }
.report-detail .row .ok-mark { color: var(--ok); }
.report-detail .row .warn-mark { color: var(--warn); }
.safety-box { margin-top: 14px; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 10px; padding: 12px 16px; font-size: 13px; }
.safety-box.bad { background: #fef2f2; border-color: #fecaca; }
.safety-box h4 { margin: 0 0 8px; font-size: 13px; }
.safety-box .s-row { display: flex; gap: 8px; padding: 2px 0; }
.safety-box .s-row .ok { color: var(--ok); }
.safety-box .s-row .no { color: var(--danger); }

/* 预览 */
.tabbar { display: flex; gap: 6px; }
.tab { border: 1px solid var(--line); background: #fff; padding: 6px 16px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.preview-tip { margin: 6px 0 12px; }
.doc-container { border: 1px solid var(--line); border-radius: 10px; background: #eef1f5; padding: 14px; min-height: 300px; overflow: auto; }
.doc-container .docx-wrapper { background: #fff; }
.doc-container .docx { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.15); margin: 0 auto 14px; padding: 0; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between h2 { margin: 0; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: #fff; border-radius: var(--radius); padding: 24px 28px; width: 380px; box-shadow: var(--shadow); }
.modal h3 { margin: 0 0 8px; }
.modal input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; margin-top: 12px; }
.modal .actions { justify-content: flex-end; }

/* loading */
.loading { position: fixed; inset: 0; background: rgba(255,255,255,.7); display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center; z-index: 200; }
.spinner { width: 36px; height: 36px; border: 4px solid #dbe4f0; border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 720px) {
  .topbar { flex-direction: column; gap: 8px; text-align: center; }
  .report-grid { grid-template-columns: repeat(2, 1fr); }
  .result-card .score-wrap { flex-direction: column; }
}
