:root {
  --bg: #eef1f4;
  --panel: #ffffff;
  --line: #d8dee5;
  --line-strong: #c3ccd5;
  --text: #1b2733;
  --muted: #5d6b79;
  --faint: #8a96a2;
  --blue: #1f6fb2;
  --blue-deep: #15527f;
  --blue-soft: #e8f1f9;
  --green: #1d7a52;
  --green-soft: #e7f3ed;
  --amber: #a86a10;
  --amber-soft: #fbf1dc;
  --red: #b3402f;
  --red-soft: #f9e9e6;
  --teal: #0e7c86;
  --teal-soft: #e5f3f4;
  --shadow: 0 1px 2px rgba(16, 30, 44, .06), 0 6px 18px rgba(16, 30, 44, .05);
  --radius: 8px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 13px/1.55 "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  letter-spacing: 0;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.hidden { display: none !important; }

svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 60px;
  padding: 0 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 4px rgba(16, 30, 44, .05);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #15527f, #1f6fb2);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  flex: none;
}
.brand-text h1 { margin: 0; font-size: 17px; line-height: 1.3; font-weight: 700; }
.brand-text p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

.top-actions { display: flex; gap: 10px; align-items: center; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  transition: background .15s, border-color .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { border-color: #9fb0bf; background: #f7f9fb; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-deep); }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }
.icon-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
}
.icon-btn:hover { background: #f0f3f6; color: var(--text); }

.layout {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  gap: 16px;
  zoom: 1.33;
  font-size: 9px;
  max-width: 1024px;
  margin: 0 auto;
  padding: 16px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 49px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stepper {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  box-shadow: var(--shadow);
}

.step-item {
  display: grid;
  grid-template-columns: 28px 1fr 18px;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 38px;
  padding: 6px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 13px;
}
.step-item:hover { background: #f2f5f8; }
.step-item.active { background: var(--blue-soft); color: var(--blue-deep); font-weight: 700; }
.step-no {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #eef2f5;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.step-item.active .step-no { background: var(--blue); color: #fff; }
.step-no svg { width: 13px; height: 13px; }
.step-status { display: flex; justify-content: flex-end; }
.step-status::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cfd6dd;
}
.step-status[data-status="pass"]::after { background: var(--green); }
.step-status[data-status="warn"]::after { background: var(--amber); }
.step-status[data-status="fail"]::after { background: var(--red); }
.step-status[data-status="manual"]::after { background: var(--teal); }
.step-divider { height: 1px; background: var(--line); margin: 6px 8px; }

.sidebar-note {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}
.sidebar-note p { margin: 0; }

.content { min-width: 0; }

.view { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }

.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-head h2 { margin: 0; font-size: 19px; line-height: 1.35; }
.section-head p { margin: 6px 0 0; color: var(--muted); font-size: 13px; max-width: 760px; }

.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 170px;
  padding: 26px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: #fafbfc;
  text-align: center;
  transition: border-color .15s, background .15s;
}
.drop-zone.drag { border-color: var(--blue); background: var(--blue-soft); }
.drop-zone svg { width: 34px; height: 34px; color: var(--blue); }
.drop-title { margin: 4px 0 0; font-weight: 700; font-size: 15px; }
.drop-hint { margin: 0; color: var(--muted); font-size: 12px; }

.file-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7f9fb;
  font-size: 12px;
  color: var(--muted);
}
.file-chip svg { width: 14px; height: 14px; }
.file-chip .ok { color: var(--green); }

.field-label { display: block; margin: 16px 0 6px; font-weight: 700; font-size: 13px; }
.paste-area {
  width: 100%;
  min-height: 220px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fbfcfd;
  resize: vertical;
  line-height: 1.6;
}
.paste-area:focus, input:focus, select:focus, textarea:focus { outline: 2px solid rgba(31, 111, 178, .35); border-color: var(--blue); }

.action-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.parse-status { color: var(--muted); font-size: 12px; }
.parse-status.error { color: var(--red); }

.step-head { align-items: center; }
.step-status-box { flex: none; }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.badge.pass { background: var(--green-soft); color: var(--green); }
.badge.warn { background: var(--amber-soft); color: var(--amber); }
.badge.fail { background: var(--red-soft); color: var(--red); }
.badge.manual { background: var(--teal-soft); color: var(--teal); }

.project-band { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; background: #fbfcfd; }
.project-band h3 { margin: 0 0 10px; font-size: 14px; }
.project-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.project-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); min-width: 0; }
.project-grid input { min-width: 0; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: 6px; font-size: 13px; color: var(--text); }

.review-controls { display: grid; grid-template-columns: 180px 1fr; gap: 12px; margin-bottom: 16px; align-items: end; }
.select-label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.select-label select, .select-label input { padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 6px; font-size: 13px; color: var(--text); background: #fff; }

.checks { display: flex; flex-direction: column; gap: 14px; }
.check-block {
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: #fff;
}
.check-block.pass { border-left-color: var(--green); }
.check-block.warn { border-left-color: var(--amber); }
.check-block.fail { border-left-color: var(--red); }
.check-block.manual { border-left-color: var(--teal); }
.check-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.check-head h4 { margin: 0; font-size: 14px; }
.check-head .badge { min-height: 22px; padding: 0 9px; font-size: 11px; }
.check-desc { margin: 0 0 8px; color: var(--muted); font-size: 12px; }
.check-summary { margin: 0 0 10px; font-size: 13px; }
.evidence-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.evidence-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 8px 10px;
  border-radius: 6px;
  background: #f6f8fa;
  font-size: 12px;
  line-height: 1.55;
}
.evidence-item .dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 5px; flex: none; }
.evidence-item.risk { background: var(--red-soft); color: #7e2e22; }
.evidence-item.risk .dot { background: var(--red); }
.evidence-item.safe { background: var(--green-soft); color: #1c5d40; }
.evidence-item.safe .dot { background: var(--green); }
.evidence-item.info { background: #f1f4f7; color: #3c4d5c; }
.evidence-item.info .dot { background: var(--blue); }
.evidence-item .ev-quote { font-weight: 600; }
.evidence-item .ev-note { color: inherit; opacity: .82; }

.missing-list, .issue-list { margin: 10px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 5px; font-size: 12px; }
.missing-list li, .issue-list li { padding: 7px 10px; border-radius: 6px; }
.missing-list li { background: var(--amber-soft); color: #7d5410; }
.issue-list li { background: var(--red-soft); color: #7e2e22; }

.nav-row { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; }

.maturity-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 8px; }
.maturity-table th, .maturity-table td { border: 1px solid var(--line); padding: 7px 9px; text-align: left; vertical-align: top; }
.maturity-table th { background: #f4f7f9; font-weight: 700; }
.state-chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.state-chip.done { background: var(--green-soft); color: var(--green); }
.state-chip.pending { background: var(--amber-soft); color: var(--amber); }
.state-chip.missing { background: #eef0f2; color: var(--muted); }
.state-chip.mentioned { background: var(--teal-soft); color: var(--teal); }

.sector-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; background: #fbfcfd; font-size: 13px; }
.sector-box h5 { margin: 0 0 6px; font-size: 13px; }
.sector-box p { margin: 4px 0; }

.conclusion-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  font-weight: 700;
  font-size: 15px;
}
.conclusion-banner.pass { background: var(--green-soft); color: var(--green); }
.conclusion-banner.warn { background: var(--amber-soft); color: var(--amber); }
.conclusion-banner.fail { background: var(--red-soft); color: var(--red); }
.conclusion-banner svg { width: 22px; height: 22px; }

.opinion-toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }

.llm-panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; background: #fbfcfd; }
.llm-status { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.llm-output {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "Microsoft YaHei", sans-serif;
  font-size: 13px;
  line-height: 1.7;
  max-height: 480px;
  overflow: auto;
}

.opinion-doc { border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 30px; background: #fff; font-size: 14px; line-height: 1.85; }
.opinion-doc h1 { font-size: 20px; text-align: center; margin: 0 0 18px; }
.opinion-doc h2 { font-size: 16px; margin: 20px 0 8px; border-bottom: 1px solid var(--line); padding-bottom: 5px; }
.opinion-doc p { margin: 6px 0; }
.opinion-doc li { margin: 4px 0; }
.opinion-doc ul, .opinion-doc ol { margin: 6px 0; padding-left: 22px; }

.calc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.calc-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: #fff; display: flex; flex-direction: column; gap: 10px; }
.calc-box h3 { margin: 0; font-size: 14px; }
.calc-formula { margin: 0; color: var(--muted); font-size: 12px; }
.calc-box label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.calc-box input { padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 6px; font-size: 13px; }
.calc-result { min-height: 34px; padding: 8px 10px; border-radius: 6px; background: #f4f7f9; font-size: 13px; color: var(--text); }
.calc-result.good { background: var(--green-soft); color: var(--green); }
.calc-result.bad { background: var(--red-soft); color: var(--red); }
.calc-result.warn { background: var(--amber-soft); color: var(--amber); }

.calc-btns { display: flex; gap: 8px; }

.history-actions { display: flex; gap: 10px; margin-bottom: 16px; }
.history-table-wrap table { width: 100%; border-collapse: collapse; font-size: 13px; }
.history-table-wrap th, .history-table-wrap td { border: 1px solid var(--line); padding: 9px 11px; text-align: left; vertical-align: top; }
.history-table-wrap th { background: #f4f7f9; font-weight: 700; }
.history-table-wrap tr:nth-child(even) td { background: #fafbfc; }
.history-link { color: var(--blue); cursor: pointer; font-weight: 600; }
.history-link:hover { text-decoration: underline; }
.history-dl { margin-left: 8px; font-size: 12px; color: var(--muted); cursor: pointer; }
.history-dl:hover { color: var(--blue); }

.date-row { display: flex; gap: 14px; }
.date-row label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.date-row input { padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 6px; font-size: 13px; }

.preview-content {
  margin: 0;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.8;
  max-height: 540px;
  overflow: auto;
}

.ref-block { margin-bottom: 18px; }
.ref-block h3 { margin: 0 0 10px; font-size: 15px; }
.ref-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ref-table th, .ref-table td { border: 1px solid var(--line); padding: 9px 11px; text-align: left; vertical-align: top; }
.ref-table th { background: #f4f7f9; font-weight: 700; }
.ref-table tr:nth-child(even) td { background: #fafbfc; }
.note-list { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.8; }

.checklist-progress { flex: none; }
.checklist-summary { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.checklist-group { margin-bottom: 16px; }
.checklist-group h3 { margin: 0 0 8px; font-size: 14px; color: var(--blue-deep); }
.check-cell { width: 40px; text-align: center; }
.check-cell input { width: 16px; height: 16px; accent-color: var(--blue); }
.check-note { margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.6; }

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 25, 36, .45);
}
.modal {
  width: min(520px, 100%);
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(10, 20, 30, .25);
  padding: 18px 20px 20px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-tip { margin: 0 0 14px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.modal label { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; font-size: 12px; color: var(--muted); }
.modal input { padding: 9px 10px; border: 1px solid var(--line-strong); border-radius: 6px; font-size: 13px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 140;
  max-width: min(520px, 90vw);
  padding: 10px 16px;
  border-radius: var(--radius);
  background: #1b2733;
  color: #fff;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(10, 20, 30, .28);
}
.toast.error { background: var(--red); }

.home-page {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  background: url('assets/home-bg.jpg') center / cover no-repeat #6b8e23;
  color: #fff;
}
.home-left {
  flex: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 0 96px;
  transform: translateX(-20px);
}
.home-left h1 {
  margin: 0;
  font-family: "Microsoft YaHei", "微软雅黑", sans-serif;
  font-size: 36pt;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0;
}
.home-left p {
  margin: 28px 0 0;
  font-family: "Microsoft YaHei", "微软雅黑", sans-serif;
  font-size: 16pt;
  line-height: 1.6;
  color: rgba(255, 255, 255, .94);
}
.home-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  width: min(360px, 100%);
  color: #fff;
  padding: 30px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transform: translateX(-25px);
}
.auth-card h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}
.auth-card input {
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 6px;
  font-size: 14px;
  color: #fff;
  background: rgba(255, 255, 255, .14);
}
.auth-card input::placeholder {
  color: rgba(255, 255, 255, .7);
}
.auth-card input:focus {
  outline: 2px solid rgba(255, 255, 255, .5);
  border-color: #fff;
}
.auth-buttons {
  display: flex;
  gap: 10px;
}
.auth-buttons .btn {
  flex: 1;
}
#btn-register {
  color: #fff;
  border-color: rgba(255, 255, 255, .55);
}

@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .stepper { display: flex; flex-wrap: wrap; gap: 4px; }
  .step-item { width: auto; grid-template-columns: 24px 1fr; }
  .step-status { display: none; }
  .step-divider { display: none; }
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .topbar { height: auto; padding: 10px 12px; flex-direction: column; align-items: flex-start; gap: 8px; position: static; }
  .top-actions { width: 100%; }
  .top-actions .btn { flex: 1; }
  .view { padding: 14px; }
  .calc-grid { grid-template-columns: 1fr; }
  .project-grid { grid-template-columns: 1fr; }
  .review-controls { grid-template-columns: 1fr; }
  .opinion-doc { padding: 16px; }
  .section-head { flex-direction: column; }
}

@media (max-width: 720px) {
  .home-page { flex-direction: column; }
  .home-left { flex: none; padding: 60px 28px 20px; }
  .home-left h1 { font-size: 28pt; }
  .home-left p { font-size: 14pt; }
  .home-right { flex: 1; }
}
