:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #dbe1e7;
  --text: #1f2933;
  --muted: #697586;
  --primary: #1d7a5f;
  --primary-strong: #145c47;
  --amber: #b7791f;
  --rose: #b42318;
  --blue: #2563a9;
  --shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #172026;
  color: #f8fafc;
  padding: 24px 18px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 56px;
  margin-bottom: 28px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #d8f3e8;
  color: #145c47;
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.brand p {
  margin: 4px 0 0;
  color: #b8c3cc;
  font-size: 12px;
}

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

.nav-button {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #cbd5df;
  padding: 11px 12px;
  text-align: left;
  cursor: pointer;
}

.nav-button:hover,
.nav-button.active {
  background: #22313a;
  color: #ffffff;
  border-color: #354853;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.topbar h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.button {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 13px;
  cursor: pointer;
  min-height: 38px;
}

.button.primary {
  background: var(--primary);
  color: white;
}

.button.primary:hover {
  background: var(--primary-strong);
}

.button.secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.button.secondary:hover {
  border-color: #b8c3cc;
}

.button-row {
  display: flex;
  gap: 8px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.scope-panel {
  margin-bottom: 14px;
}

.metric-card,
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 16px;
  min-height: 108px;
}

.metric-card span {
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  display: block;
  margin-top: 14px;
  font-size: 30px;
  line-height: 1;
}

.metric-card small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
}

.dashboard-layout,
.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  gap: 14px;
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.panel-header {
  min-height: 58px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-header h3 {
  margin: 0;
  font-size: 16px;
}

.topic-bars,
.compact-list,
.topic-list,
.detail-content {
  padding: 14px 16px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(130px, 190px) 1fr 72px;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #eef2f5;
}

.bar-row:last-child {
  border-bottom: 0;
}

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

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.compact-item,
.topic-item {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  margin-bottom: 10px;
  cursor: pointer;
}

.compact-item:last-child,
.topic-item:last-child {
  margin-bottom: 0;
}

.topic-item.active {
  border-color: var(--primary);
  background: #f0fbf7;
}

.item-title {
  font-weight: 700;
}

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

.status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
  background: #edf2f7;
  color: #344054;
}

.status.ACTIVE,
.status.SCORED {
  background: #e5f6ef;
  color: var(--primary-strong);
}

.status.DISABLED {
  background: #f2f4f7;
  color: #667085;
}

.status.SUBMITTED {
  background: #fff4df;
  color: var(--amber);
}

.status.CREATED {
  background: #e9f2ff;
  color: var(--blue);
}

.editor-panel {
  min-height: 680px;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 14px;
  padding: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

label.wide {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 10px 11px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 122, 95, 0.12);
}

.filters {
  align-items: center;
}

.filter-row {
  display: flex;
  gap: 8px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid #eef2f5;
  text-align: left;
  white-space: nowrap;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  background: #fbfcfd;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: #f6faf8;
}

.detail-panel {
  margin-top: 14px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.detail-box {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-2);
}

.detail-box span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.detail-box strong {
  display: block;
  margin-top: 6px;
}

pre {
  overflow: auto;
  max-height: 320px;
  margin: 12px 0 0;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #111827;
  color: #e5e7eb;
  font-size: 12px;
  line-height: 1.5;
}

.detail-section {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 14px;
}

.detail-section h4 {
  margin: 0 0 12px;
  font-size: 15px;
}

.detail-section p {
  margin: 0;
  line-height: 1.65;
}

.empty-text {
  color: var(--muted);
}

.link-list,
.dimension-list,
.evidence-list {
  display: grid;
  gap: 8px;
}

.reference-link,
.reference-text {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: #ffffff;
  color: var(--primary-strong);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.qa-item,
.dimension-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.qa-item + .qa-item {
  margin-top: 10px;
}

.qa-question {
  font-weight: 700;
  margin-bottom: 8px;
}

.qa-answer {
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 8px;
}

.report-summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}

.report-summary strong {
  font-size: 24px;
}

.report-summary span {
  color: var(--primary-strong);
  font-weight: 700;
}

.dimension-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.dimension-item span {
  display: block;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.5;
}

.dimension-item b {
  white-space: nowrap;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #172026;
  color: #fff;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.empty {
  color: var(--muted);
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 14px 16px;
  }

  .brand {
    margin-bottom: 12px;
  }

  .nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .nav-button {
    text-align: center;
  }

  .metric-grid,
  .dashboard-layout,
  .split-layout {
    grid-template-columns: 1fr;
  }
}

.file-list {
  display: grid;
  gap: 8px;
  min-height: 42px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 10px 12px;
}

.file-item a {
  color: var(--primary-strong);
  text-decoration: none;
  font-weight: 700;
}

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

@media (max-width: 640px) {
  .workspace {
    padding: 14px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .metric-grid {
    gap: 10px;
  }

  .form-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .bar-row {
    grid-template-columns: 1fr;
  }
}
