:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1a1f2b;
  --muted: #657184;
  --line: #dfe4ec;
  --blue: #2364aa;
  --green: #1c7c54;
  --red: #b23a48;
  --gold: #b8872f;
  --violet: #7057a3;
  --shadow: 0 12px 30px rgba(26, 31, 43, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 32px 22px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 28px;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 4px;
  font-size: 18px;
}

.subtle,
.section-title p,
.status {
  color: var(--muted);
}

.status {
  display: grid;
  gap: 6px;
  justify-items: end;
  min-width: 190px;
  font-size: 13px;
}

main {
  padding: 20px 32px 36px;
}

.importance-panel {
  margin-top: 16px;
  padding: 14px;
  box-shadow: none;
}

.importance-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.9fr) minmax(260px, 0.8fr);
  gap: 10px;
  align-items: start;
  font-size: 12px;
}

.importance-panel .section-title {
  margin-bottom: 8px;
}

.importance-panel .section-title h2 {
  font-size: 15px;
}

.importance-panel .section-title p {
  font-size: 12px;
}

.importance-copy h3 {
  margin-bottom: 4px;
  font-size: 13px;
}

.importance-copy p {
  margin-bottom: 0;
  color: #2f3746;
  font-size: 12px;
}

.criteria-list,
.score-rubric {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.criterion {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 8px;
  background: #f8fafc;
  color: #39465a;
  font-size: 12px;
}

.rubric-item {
  display: grid;
  min-width: 96px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  background: #fbfcfe;
  font-size: 12px;
}

.rubric-item span {
  color: var(--muted);
  font-size: 11px;
}

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

button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  border-radius: 8px;
  min-height: 34px;
  padding: 0 12px;
  font: inherit;
  cursor: pointer;
}

button.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(360px, 0.8fr);
  gap: 16px;
  align-items: start;
}

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

.right {
  display: grid;
  gap: 16px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
}

.section-title p {
  margin-bottom: 0;
  font-size: 13px;
  text-align: right;
}

.news-list {
  display: grid;
  gap: 10px;
}

.news-card {
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  padding: 0;
  background: #ffffff;
  overflow: hidden;
}

.news-summary {
  display: block;
  position: relative;
  padding: 12px 44px 12px 14px;
  cursor: pointer;
  list-style: none;
}

.news-summary::-webkit-details-marker {
  display: none;
}

.news-summary::after {
  content: "+";
  position: absolute;
  top: 16px;
  right: 16px;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--blue);
  display: grid;
  place-items: center;
  font-weight: 700;
  line-height: 1;
}

.news-card[open] .news-summary::after {
  content: "-";
}

.summary-content {
  display: grid;
  gap: 7px;
}

.news-title {
  display: block;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
  background: #edf2f7;
  color: #39465a;
}

.tag.region {
  background: #e8f4ee;
  color: var(--green);
}

.tag.impact-high {
  background: #fff0f0;
  color: var(--red);
}

.tag.impact-medium {
  background: #fff7e6;
  color: var(--gold);
}

.score-tag {
  background: #eef3ff;
  color: var(--blue);
}

.news-detail {
  border-top: 1px solid var(--line);
  padding: 12px 14px 14px;
  background: #fbfcfe;
}

.news-detail p {
  margin-bottom: 10px;
  color: #2f3746;
}

.reason {
  color: var(--muted);
  font-size: 13px;
}

.source-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.source-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border: 1px solid var(--blue);
  border-radius: 8px;
  padding: 0 12px;
  background: #ffffff;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.source-button.disabled {
  border-color: var(--line);
  color: var(--muted);
  background: #f3f5f8;
}

.source {
  color: var(--muted);
  font-size: 12px;
}

.bars {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) 26px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.bar-track {
  height: 10px;
  background: #edf1f5;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--blue);
}

.graph-shell {
  position: relative;
  overflow: visible;
}

#relationGraph {
  display: block;
  width: 100%;
  height: 300px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  touch-action: none;
  user-select: none;
}

.layer-guides line {
  stroke: #dfe4ec;
  stroke-dasharray: 5 8;
  stroke-width: 1;
}

.layer-labels rect {
  fill: #edf2f7;
  stroke: #d6dde8;
}

.layer-labels text {
  fill: #39465a;
  font-size: 12px;
  font-weight: 700;
}

.graph-node {
  cursor: grab;
  outline: none;
  transition: opacity 0.16s ease;
  touch-action: none;
}

.graph-node.is-dragging {
  cursor: grabbing;
}

.graph-node text {
  pointer-events: none;
  font-size: 12px;
  font-weight: 700;
  fill: #1f2937;
}

.node-halo {
  opacity: 0.12;
}

.node-core {
  stroke-width: 2.2;
  transition: stroke-width 0.16s ease, filter 0.16s ease;
}

.graph-edge {
  fill: none;
  stroke: #8e9aac;
  stroke-width: 2;
  opacity: 0.58;
  cursor: pointer;
  pointer-events: stroke;
  transition: opacity 0.16s ease, stroke-width 0.16s ease, stroke 0.16s ease;
}

.edge-label {
  fill: #758398;
  font-size: 11px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
}

.graph-node.is-active .node-core,
.graph-node.is-related .node-core {
  stroke-width: 3.2;
  filter: drop-shadow(0 3px 8px rgba(35, 100, 170, 0.18));
}

.graph-edge.is-active,
.graph-edge.is-related {
  stroke: var(--blue);
  stroke-width: 3.2;
  opacity: 1;
}

.edge-label.is-active,
.edge-label.is-related {
  opacity: 1;
}

.graph-node.is-dim,
.graph-edge.is-dim {
  opacity: 0.2;
}

.edge-label.is-dim {
  opacity: 0;
}

.graph-tooltip {
  position: absolute;
  z-index: 5;
  width: min(280px, calc(100% - 20px));
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 26px rgba(26, 31, 43, 0.16);
  pointer-events: none;
  color: var(--ink);
  font-size: 13px;
}

.graph-tooltip h3 {
  margin-bottom: 4px;
  font-size: 14px;
}

.graph-tooltip p {
  margin-bottom: 6px;
  color: var(--muted);
}

.graph-tooltip ul {
  margin: 0;
  padding-left: 16px;
}

.graph-tooltip li + li {
  margin-top: 4px;
}

.tooltip-news {
  margin-top: 8px;
  margin-bottom: 4px;
  color: var(--muted);
  font-weight: 700;
}

.advice-panel {
  margin-top: 16px;
}

.risk-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #f0d8a8;
  background: #fffaf0;
  border-radius: 8px;
  color: #76581d;
  font-size: 13px;
}

.ledger-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border: 1px solid #c99432;
  border-radius: 8px;
  padding: 0 10px;
  color: #76581d;
  background: #ffffff;
  font-weight: 700;
  text-decoration: none;
}

.advice-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(180px, 1fr));
  gap: 10px;
}

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

.advice-card h3 {
  margin-bottom: 8px;
  font-size: 15px;
}

.score {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}

.score-track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: #edf1f5;
}

.score-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--green);
}

.small {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 1080px) {
  .layout,
  .importance-grid,
  .advice-list {
    grid-template-columns: 1fr;
  }

  .topbar,
  .risk-note,
  .section-title {
    display: block;
  }

  .ledger-link {
    margin-top: 8px;
  }

  .section-title p,
  .status {
    text-align: left;
    justify-items: start;
  }
}

@media (max-width: 640px) {
  .topbar,
  main {
    padding-left: 16px;
    padding-right: 16px;
  }

  h1 {
    font-size: 23px;
  }
}
