:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #65717d;
  --line: #d8e0e7;
  --surface: #ffffff;
  --soft: #f5f7fa;
  --teal: #006d77;
  --teal-dark: #04535c;
  --amber: #b86800;
  --red: #b3261e;
  --green: #2d6a4f;
  --blue: #1f5f99;
  --focus: rgba(0, 109, 119, 0.24);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #eef2f4;
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 32px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.22;
}

h2 {
  font-size: 20px;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 560px;
}

.status-strip span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  background: var(--soft);
  color: #34414d;
  font-size: 13px;
  white-space: nowrap;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(460px, 1.1fr);
  gap: 20px;
  padding: 20px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  min-width: 0;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.upload-zone {
  position: relative;
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 170px;
  padding: 24px;
  border: 2px dashed #9eb4bd;
  border-radius: 8px;
  background: #f8fbfc;
  text-align: center;
  outline: none;
}

.upload-zone.dragover,
.upload-zone:focus-visible {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px var(--focus);
}

.upload-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-size: 28px;
  line-height: 1;
}

.upload-zone span,
.fineprint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.file-list {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.file-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.file-name {
  overflow-wrap: anywhere;
  font-weight: 700;
}

.file-meta {
  color: var(--muted);
  font-size: 12px;
}

.review-form {
  display: grid;
  gap: 14px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: #34414d;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #bdc9d2;
  border-radius: 6px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--focus);
}

.checklist-block,
.history-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
}

.block-title {
  margin-bottom: 10px;
  font-weight: 800;
}

.risk-checkboxes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-weight: 600;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  padding: 0;
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.actions-row.compact {
  margin-top: 12px;
}

.primary-button,
.secondary-button,
.ghost-button,
.tab {
  min-height: 40px;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 9px 14px;
  font-weight: 800;
}

.primary-button {
  background: var(--teal);
  color: #fff;
}

.primary-button:hover {
  background: var(--teal-dark);
}

.secondary-button {
  background: #f2f7f8;
  color: var(--teal-dark);
  border-color: #a9c6ca;
}

.ghost-button {
  background: transparent;
  color: #42505c;
  border-color: var(--line);
}

.judgement-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 8px 13px;
  background: #e8edf1;
  color: #34414d;
  font-weight: 900;
  white-space: nowrap;
}

.judgement-pill.pass {
  background: #e5f3ec;
  color: var(--green);
}

.judgement-pill.fix {
  background: #fff1d8;
  color: var(--amber);
}

.judgement-pill.reject {
  background: #fde7e4;
  color: var(--red);
}

.standard-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.tab {
  border-color: var(--line);
  border-bottom: 0;
  background: #f7f9fb;
  color: #465461;
  border-radius: 6px 6px 0 0;
}

.tab.active {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}

.standard-panel {
  display: none;
  margin-bottom: 14px;
}

.standard-panel.active {
  display: block;
}

.standard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.standard-card,
.info-card {
  min-height: 86px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.standard-card strong,
.info-card strong {
  display: block;
  margin-bottom: 5px;
}

.standard-card span,
.info-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.info-card.emphasis {
  border-color: #a9c6ca;
  background: #f2f8f8;
}

.knowledge-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  gap: 14px;
}

.knowledge-form {
  display: grid;
  gap: 12px;
}

.knowledge-list {
  display: grid;
  align-content: start;
  gap: 10px;
  max-height: 420px;
  overflow: auto;
}

.knowledge-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.knowledge-item strong {
  display: block;
  margin-bottom: 5px;
}

.knowledge-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.chat-shell {
  display: grid;
  gap: 12px;
}

.chat-log {
  display: grid;
  gap: 10px;
  min-height: 280px;
  max-height: 430px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.chat-message {
  display: grid;
  gap: 5px;
  max-width: 86%;
  padding: 10px 12px;
  border-radius: 8px;
  line-height: 1.55;
}

.chat-message strong {
  font-size: 13px;
}

.chat-message span {
  white-space: pre-wrap;
}

.chat-message.user {
  justify-self: end;
  background: #e8f3f5;
  border: 1px solid #a9c6ca;
}

.chat-message.assistant {
  justify-self: start;
  background: #fff;
  border: 1px solid var(--line);
}

.chat-message.error {
  background: #fde7e4;
  border-color: #efb8b2;
  color: var(--red);
}

.chat-input-row {
  display: grid;
  gap: 10px;
}

.report-toolbar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0;
}

.report-toolbar > div {
  padding: 12px;
  border-radius: 8px;
  background: var(--soft);
  border: 1px solid var(--line);
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.report-output {
  min-height: 560px;
  max-height: 720px;
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid #bac6cf;
  border-radius: 8px;
  padding: 18px;
  background: #101820;
  color: #f4f7f8;
  line-height: 1.7;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
}

.history-panel {
  margin-top: 14px;
}

.history-panel ol {
  margin: 0;
  padding-left: 20px;
  color: #34414d;
}

.history-panel li {
  margin: 7px 0;
}

@media (max-width: 1080px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-strip {
    justify-content: flex-start;
  }

  .workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .topbar,
  .workspace {
    padding-left: 14px;
    padding-right: 14px;
  }

  .field-grid,
  .risk-checkboxes,
  .standard-grid,
  .info-grid,
  .knowledge-layout,
  .report-toolbar {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .standard-tabs {
    overflow-x: auto;
  }

  .tab {
    flex: 0 0 auto;
  }
}
