:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-alt: #f9fbfc;
  --text: #1d2733;
  --muted: #667280;
  --line: #dbe3ea;
  --blue: #2f6fbb;
  --teal: #147c72;
  --amber: #a86200;
  --red: #a43d3d;
  --green: #2c7659;
  --shadow: 0 8px 24px rgba(27, 39, 51, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

button, input, select {
  font: inherit;
}

.topbar {
  min-height: 72px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
}

.brand-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.top-controls {
  display: grid;
  grid-template-columns: minmax(220px, 360px) 160px 72px;
  gap: 8px;
  align-items: center;
}

input, select, button {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}

input, select {
  padding: 0 10px;
}

button {
  cursor: pointer;
}

button:hover, .item:hover, .chip:hover {
  border-color: #8eb2d9;
}

.tabs {
  height: 44px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 72px;
  z-index: 19;
}

.tab {
  min-width: 76px;
  height: 30px;
  border-radius: 6px;
  color: var(--muted);
}

.tab.active {
  background: #eaf2fb;
  border-color: #9fc1e5;
  color: var(--blue);
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 360px;
  gap: 14px;
  padding: 14px;
  min-height: calc(100vh - 116px);
}

.sidebar, .content, .rightpane {
  min-width: 0;
}

.sidebar, .rightpane {
  position: sticky;
  top: 130px;
  align-self: start;
  max-height: calc(100vh - 144px);
  overflow: auto;
}

.sidebar-head, .pane-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  margin: 2px 0 8px;
}

.list {
  display: grid;
  gap: 8px;
}

.item {
  width: 100%;
  text-align: left;
  min-height: 88px;
  height: auto;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  display: grid;
  gap: 6px;
}

.item.active {
  border-color: #72a8df;
  box-shadow: var(--shadow);
}

.item-title {
  font-weight: 700;
  line-height: 1.35;
}

.item-meta, .fine {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.item-tags, .chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  border: 1px solid var(--line);
  background: var(--surface-alt);
  color: var(--text);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  min-height: 24px;
  line-height: 1.2;
}

.chip.primary { color: var(--blue); border-color: #b6d2ee; background: #eef6ff; }
.chip.good { color: var(--green); border-color: #b8dccd; background: #effaf5; }
.chip.warn { color: var(--amber); border-color: #e6c78e; background: #fff8e8; }
.chip.danger { color: var(--red); border-color: #e2b7b7; background: #fff0f0; }

.hero, .section, .report-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero {
  padding: 18px;
  margin-bottom: 12px;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: 24px;
  line-height: 1.28;
  letter-spacing: 0;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 0;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.action-row a, .action-row button {
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--blue);
  background: var(--surface);
  text-decoration: none;
}

.section {
  padding: 16px;
  margin-bottom: 12px;
}

.section h2, .report-block h2 {
  margin: 0 0 10px;
  font-size: 17px;
  letter-spacing: 0;
}

.markdown {
  color: #263342;
  line-height: 1.72;
  font-size: 15px;
}

.markdown h1, .markdown h2, .markdown h3 {
  margin: 16px 0 8px;
  line-height: 1.35;
  letter-spacing: 0;
}

.markdown h1 { font-size: 22px; }
.markdown h2 { font-size: 18px; }
.markdown h3 { font-size: 16px; }
.markdown p { margin: 8px 0; }
.markdown ul, .markdown ol { margin: 8px 0 8px 22px; padding: 0; }
.markdown blockquote {
  margin: 10px 0;
  padding: 8px 12px;
  border-left: 3px solid #91b7df;
  background: #f3f8fd;
  color: #405062;
}
.markdown code {
  padding: 2px 4px;
  border-radius: 4px;
  background: #eef1f4;
}

.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.subtab {
  min-width: 82px;
  height: 32px;
  color: var(--muted);
}

.subtab.active {
  color: var(--teal);
  border-color: #8fc8c1;
  background: #eaf8f6;
  font-weight: 700;
}

.checklist-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.check-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.check-card.wide {
  grid-column: 1 / -1;
}

.check-card h3 {
  margin: 0 0 8px;
  font-size: 15px;
  color: var(--teal);
  letter-spacing: 0;
}

.check-card p {
  margin: 0;
  color: #263342;
  line-height: 1.7;
}

.check-list {
  margin: 0;
  padding-left: 20px;
  color: #263342;
  line-height: 1.65;
}

.check-list li + li {
  margin-top: 6px;
}

.pane-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.graph-box {
  height: 330px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fbfcfd;
}

.graph-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.graph-line {
  stroke: #b7c5d1;
  stroke-width: 1;
}

.node circle {
  stroke: #ffffff;
  stroke-width: 2;
}

.node.article circle { fill: #2f6fbb; }
.node.concept circle { fill: #147c72; }
.node.system circle { fill: #a86200; }
.node text {
  font-size: 11px;
  fill: #263342;
  paint-order: stroke;
  stroke: #fbfcfd;
  stroke-width: 3px;
  stroke-linejoin: round;
}

.node { cursor: pointer; }

.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.report-block {
  padding: 14px;
  min-height: 160px;
}

.empty {
  padding: 24px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 300px minmax(0, 1fr);
  }
  .rightpane {
    display: none;
  }
}

@media (max-width: 820px) {
  .topbar {
    position: static;
    align-items: stretch;
    flex-direction: column;
  }
  .tabs {
    position: static;
    top: auto;
    overflow-x: auto;
  }
  .top-controls {
    grid-template-columns: 1fr;
  }
  .layout {
    grid-template-columns: 1fr;
    padding: 10px;
  }
  .sidebar {
    position: static;
    max-height: 280px;
  }
  .report-grid {
    grid-template-columns: 1fr;
  }
  .checklist-grid {
    grid-template-columns: 1fr;
  }
  .hero h1 {
    font-size: 20px;
  }
}
