:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #667085;
  --line: #d9e1ea;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --accent: #c2410c;
  --soft: #e8f4f2;
  --warn: #fff4e6;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.sidebar {
  width: 248px;
  background: #111827;
  color: #fff;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.brand { display: flex; gap: 12px; align-items: center; }
.mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  font-weight: 700;
}
.brand span { display: block; margin-top: 4px; color: #b7c3d0; font-size: 12px; }
nav { display: grid; gap: 8px; }
.nav {
  height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #d4dde8;
  text-align: left;
  cursor: pointer;
}
.nav.active, .nav:hover { background: #223044; color: #fff; }

main { flex: 1; padding: 26px; overflow: auto; }
.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}
.actions {
  display: grid;
  justify-items: end;
  gap: 8px;
  min-width: 150px;
}
.status {
  color: var(--muted);
  font-size: 12px;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; line-height: 1.2; }
.topbar p { margin-top: 8px; color: var(--muted); max-width: 760px; line-height: 1.6; }

button, input, textarea, select { font: inherit; }
.primary {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}
.primary:hover { background: var(--brand-dark); }
.ghost {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.view { display: none; }
.view.active { display: block; }
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.metric, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.metric { padding: 16px; }
.metric span { display: block; color: var(--muted); font-size: 13px; }
.metric strong { display: block; margin-top: 8px; font-size: 26px; }

.grid.two, .split {
  display: grid;
  grid-template-columns: minmax(340px, .9fr) minmax(520px, 1.4fr);
  gap: 18px;
  align-items: start;
}
.panel { padding: 18px; }
.panel.wide { max-width: 1100px; margin-top: 18px; }
.detail-panel { min-height: 520px; }
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}
.panel-head h2 { font-size: 19px; }
.panel-head span { color: var(--muted); font-size: 13px; }
.list { display: grid; gap: 10px; }
.list.cards {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}
.item.clickable { cursor: pointer; transition: border-color .18s ease, box-shadow .18s ease; }
.item.clickable:hover, .item.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .1);
}
.item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.item strong { font-size: 15px; }
.item p { color: var(--muted); line-height: 1.5; font-size: 13px; }
.tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--brand-dark);
  padding: 0 9px;
  font-size: 12px;
  white-space: nowrap;
}
.tag.warn { background: var(--warn); color: var(--accent); }
.tag.evidence {
  height: auto;
  min-height: 24px;
  white-space: normal;
  line-height: 1.5;
  padding-top: 3px;
  padding-bottom: 3px;
}
.mini-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
}
label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}
textarea { min-height: 92px; resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15, 118, 110, .12); }
.span2 { grid-column: span 2; }
.questionnaire {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfb;
}
.questionnaire-intro {
  padding: 14px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--brand-dark);
}
.questionnaire-intro p {
  margin-top: 6px;
  line-height: 1.5;
}
.availability {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfb;
  color: var(--brand-dark);
  font-size: 13px;
}
.question-builder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.question-builder-head label { color: var(--muted); }
.project-questionnaire {
  display: grid;
  gap: 12px;
}
.builder-question {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfb;
}
.builder-row {
  display: grid;
  grid-template-columns: auto minmax(160px, 1fr) auto;
  align-items: center;
  gap: 10px;
}
.builder-row strong {
  color: var(--brand-dark);
  font-size: 14px;
}
.ghost:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.muted-field {
  opacity: .62;
}
.model-result {
  margin-top: 16px;
}
.empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fafcff;
}
.report {
  display: grid;
  gap: 16px;
}
.report-block {
  border-left: 4px solid var(--brand);
  background: #f8fbfb;
  padding: 14px;
  border-radius: 6px;
}
.answer {
  display: grid;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.answer:last-child { border-bottom: 0; }
.answer h3 { font-size: 15px; }
.answer p { color: #344054; line-height: 1.6; }
.section-title {
  margin-bottom: 8px;
  font-size: 16px;
}
.qa-list {
  display: grid;
  gap: 10px;
}
.qa {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.qa:last-child { border-bottom: 0; }
.qa strong { display: block; font-size: 13px; line-height: 1.5; }
.qa p { margin-top: 4px; color: #344054; line-height: 1.6; }
.loading-card {
  min-height: 300px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fafcff;
  color: var(--muted);
  padding: 28px;
}
.loading-card h3 { color: var(--ink); }
.spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 4px solid #d7e5e3;
  border-top-color: var(--brand);
  animation: spin .85s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 900px) {
  body { display: block; }
  .sidebar { width: 100%; }
  nav { grid-template-columns: repeat(3, 1fr); }
  .topbar, .panel-head { flex-direction: column; align-items: stretch; }
  .actions { justify-items: stretch; }
  .metrics, .grid.two, .split, .form-grid, .questionnaire, .list.cards { grid-template-columns: 1fr; }
  .span2 { grid-column: span 1; }
}
