:root {
  --ink: #17211d;
  --muted: #66736d;
  --line: #dce3df;
  --surface: #ffffff;
  --surface-soft: #f5f7f6;
  --green: #147a52;
  --green-dark: #0e5c3d;
  --green-soft: #e7f4ed;
  --amber: #a86105;
  --amber-soft: #fff4dd;
  --red: #a63b32;
  --red-soft: #fff0ed;
  --shadow: 0 12px 30px rgba(29, 48, 39, 0.08);
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #eef2ef;
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  letter-spacing: 0;
}

button, input { font: inherit; letter-spacing: 0; }

.topbar {
  height: 58px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; }
.brand-mark {
  width: 30px; height: 30px; display: grid; place-items: center;
  color: white; background: var(--green); border-radius: 6px;
  font-family: Georgia, serif; font-size: 18px;
}
.status { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #28a66a; box-shadow: 0 0 0 3px var(--green-soft); }

main { width: 100%; padding: 44px 24px 34px; }
.workspace { width: min(980px, 100%); margin: 0 auto; }
.heading-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 7px; color: var(--green); font-size: 13px; font-weight: 700; }
h1 { margin: 0; max-width: 700px; font-size: clamp(27px, 4vw, 40px); line-height: 1.18; font-weight: 750; }
.threshold { flex: 0 0 auto; display: flex; align-items: baseline; gap: 3px; color: var(--muted); }
.threshold span { margin-right: 8px; font-size: 12px; }
.threshold strong { color: var(--green-dark); font-size: 28px; }
.threshold small { font-size: 12px; }

.input-panel, .progress-panel, .error-panel, .result {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.input-panel { padding: 24px; }
.input-panel label { display: block; margin-bottom: 9px; font-size: 13px; font-weight: 700; }
.input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
input {
  width: 100%; height: 46px; padding: 0 14px;
  color: var(--ink); background: var(--surface);
  border: 1px solid #bdc9c2; border-radius: 6px; outline: none;
}
input:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
button, .secondary-button { min-height: 44px; border-radius: 6px; cursor: pointer; }
#submit-button {
  padding: 0 18px; display: flex; align-items: center; justify-content: center; gap: 8px;
  color: white; background: var(--green); border: 1px solid var(--green);
  font-weight: 700;
}
#submit-button:hover { background: var(--green-dark); }
#submit-button:disabled { opacity: .65; cursor: wait; }
.button-icon { font-size: 18px; }
.field-note { margin: 10px 0 0; color: var(--muted); font-size: 12px; }

.progress-panel, .error-panel { margin-top: 18px; padding: 21px 24px; }
.progress-panel { display: flex; align-items: center; gap: 15px; }
.progress-panel[hidden], .error-panel[hidden], .result[hidden] { display: none; }
.progress-panel p, .error-panel p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--green-soft); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-panel { color: var(--red); background: var(--red-soft); border-color: #f0c9c4; box-shadow: none; }
.error-panel p { color: #744942; }

.result { margin-top: 22px; overflow: hidden; }
.result-header { padding: 26px; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.result-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.badge { padding: 5px 8px; border-radius: 4px; font-size: 12px; font-weight: 700; }
.badge.selected { color: var(--green-dark); background: var(--green-soft); }
.badge.rejected { color: var(--amber); background: var(--amber-soft); }
h2 { margin: 12px 0 0; max-width: 710px; font-size: 23px; line-height: 1.45; }
.score-total { min-width: 100px; text-align: right; white-space: nowrap; }
.score-total strong { color: var(--green-dark); font-size: 42px; line-height: 1; }
.score-total span { color: var(--muted); font-size: 13px; }
.score-grid { padding: 20px 26px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; background: var(--surface-soft); border-bottom: 1px solid var(--line); }
.score-item { min-width: 0; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.score-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.score-name { color: var(--muted); font-size: 12px; }
.score-value { font-size: 18px; font-weight: 800; }
.score-reason { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.content-grid { padding: 26px; display: grid; grid-template-columns: 1.25fr .75fr; gap: 34px; }
.content-section h3, .risk-section h3 { margin: 0 0 10px; font-size: 14px; }
.content-section p, .risk-section p { margin: 0; color: #435049; font-size: 14px; line-height: 1.85; white-space: pre-wrap; }
.risk-section { margin: 0 26px 24px; padding: 16px; display: flex; gap: 12px; background: var(--amber-soft); border-left: 3px solid #d28a22; }
.risk-icon { width: 22px; height: 22px; flex: 0 0 auto; display: grid; place-items: center; color: white; background: var(--amber); border-radius: 50%; font-size: 13px; font-weight: 800; }
.result-actions { padding: 18px 26px; display: flex; align-items: center; gap: 18px; border-top: 1px solid var(--line); }
.secondary-button { padding: 0 15px; display: inline-flex; align-items: center; color: var(--green-dark); background: white; border: 1px solid #9eb7aa; text-decoration: none; font-size: 13px; font-weight: 700; }
.secondary-button:hover { background: var(--green-soft); }
.text-button { min-height: auto; padding: 8px 0; color: var(--muted); background: transparent; border: 0; font-size: 13px; }
.text-button:hover { color: var(--ink); }
footer { padding: 0 24px 28px; color: #76847d; text-align: center; font-size: 11px; }

@media (max-width: 780px) {
  .topbar { padding: 0 16px; }
  main { padding: 28px 14px; }
  .heading-row { align-items: flex-start; }
  .threshold { display: none; }
  .input-panel { padding: 18px; }
  .input-row { grid-template-columns: 1fr; }
  #submit-button { width: 100%; }
  .result-header { padding: 20px; }
  .score-total { min-width: 74px; }
  .score-total strong { font-size: 34px; }
  .score-grid { padding: 16px 20px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-grid { padding: 22px 20px; grid-template-columns: 1fr; gap: 24px; }
  .risk-section { margin: 0 20px 20px; }
}

@media (max-width: 480px) {
  h1 { font-size: 27px; }
  .status { font-size: 0; }
  .result-header { display: block; }
  .score-total { margin-top: 16px; text-align: left; }
  .score-grid { grid-template-columns: 1fr; }
  h2 { font-size: 19px; }
}
