:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --ink: #16211f;
  --muted: #65716d;
  --line: #dbe4df;
  --primary: #16725f;
  --primary-dark: #0d4f43;
  --gold: #b8893b;
  --amber: #bc7a1d;
  --red: #b42318;
  --blue: #2267a8;
  --card-shadow: 0 18px 55px rgba(21, 35, 31, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

a {
  color: inherit;
  text-decoration: none;
}

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

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  background: #11231f;
  color: #eff8f4;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 4px;
  color: #b8cac4;
  font-size: 12px;
}

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

.nav-item {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 12px 14px;
  border-radius: 8px;
  color: #c9d7d2;
  cursor: pointer;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.safety-note {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.safety-note p {
  margin: 8px 0 0;
  color: #c5d6d0;
  line-height: 1.6;
  font-size: 13px;
}

main {
  min-width: 0;
  min-height: 100vh;
}

.view-panel[hidden] {
  display: none !important;
}

.view-panel {
  min-height: 100vh;
}

.hero {
  min-height: 560px;
  padding: 56px clamp(22px, 5vw, 72px);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.58fr);
  align-items: center;
  gap: 36px;
  background: linear-gradient(135deg, #f8fbfa 0%, #eef5f2 48%, #f7f2e8 100%);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 36px clamp(18px, 4vw, 64px) auto auto;
  width: min(460px, 36vw);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(184, 137, 59, 0.55), transparent);
}

.hero::after {
  content: "";
  position: absolute;
  right: clamp(18px, 4vw, 64px);
  bottom: 34px;
  width: min(520px, 42vw);
  height: min(280px, 32vh);
  border: 1px solid rgba(22, 114, 95, 0.18);
  background:
    linear-gradient(90deg, rgba(22, 114, 95, 0.12) 1px, transparent 1px),
    linear-gradient(0deg, rgba(22, 114, 95, 0.1) 1px, transparent 1px);
  background-size: 34px 34px;
  opacity: 0.5;
  pointer-events: none;
}

.eyebrow {
  color: var(--gold);
  font-weight: 700;
  margin: 0 0 16px;
  letter-spacing: 0.08em;
  font-size: 12px;
}

.hero h1 {
  margin: 0;
  max-width: 780px;
  font-size: clamp(38px, 6vw, 72px);
  line-height: 1.05;
  letter-spacing: 0;
}

.hero p {
  max-width: 760px;
  color: #3e4d49;
  line-height: 1.8;
  font-size: 18px;
}

.hero-copy,
.clinical-console {
  position: relative;
  z-index: 1;
}

.hero-actions,
.form-actions,
.care-tools,
.quiz-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.primary-action,
.secondary-action,
.primary-button,
.secondary-button,
.ghost-button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 11px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

button.primary-action,
button.secondary-action {
  border: 0;
}

.primary-action,
.primary-button {
  background: var(--primary);
  color: #fff;
}

.primary-action:hover,
.primary-button:hover {
  background: var(--primary-dark);
}

.secondary-action,
.secondary-button {
  background: #e9f1ee;
  color: #17342d;
}

.ghost-button {
  background: transparent;
  color: var(--primary-dark);
  border: 1px solid var(--line);
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
}

.evidence-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.evidence-strip span {
  padding: 8px 10px;
  border: 1px solid rgba(22, 114, 95, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: #27453d;
  font-size: 12px;
  font-weight: 800;
}

.clinical-console {
  display: grid;
  gap: 14px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.88);
  box-shadow: var(--card-shadow);
  border-radius: 8px;
  backdrop-filter: blur(10px);
}

.console-top {
  padding: 22px;
  border-radius: 8px;
  background: #11231f;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.console-top span,
.console-top strong,
.console-top p {
  display: block;
}

.console-top span {
  color: #b9cbc5;
  margin-bottom: 10px;
}

.console-top strong {
  font-size: 40px;
  line-height: 1;
}

.console-top p {
  margin: 12px 0 0;
  color: #cbdad5;
  font-size: 13px;
}

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

.vital-panel div {
  padding: 14px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.vital-panel span,
.vital-panel strong {
  display: block;
}

.vital-panel span {
  color: var(--muted);
  margin-bottom: 8px;
  font-size: 12px;
}

.vital-panel strong {
  font-size: 18px;
}

.console-note {
  padding: 12px 14px;
  color: #5f5140;
  background: #fff8ea;
  border: 1px solid rgba(184, 137, 59, 0.24);
  border-radius: 8px;
  line-height: 1.6;
  font-size: 13px;
}

.console-note span {
  display: block;
}

.home-action-grid {
  display: grid;
  gap: 10px;
}

.home-action-grid button {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  cursor: pointer;
}

.home-action-grid button:hover {
  border-color: rgba(22, 114, 95, 0.42);
  box-shadow: 0 12px 30px rgba(21, 35, 31, 0.08);
}

.home-action-grid strong,
.home-action-grid span {
  display: block;
}

.home-action-grid span {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.5;
  font-size: 13px;
}

.quick-upload {
  margin: 28px clamp(18px, 4vw, 64px) 0;
  padding: 22px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  box-shadow: var(--card-shadow);
}

.quick-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #11231f;
  color: #f2c46d;
  font-size: 30px;
  flex: 0 0 auto;
}

.quick-upload h2 {
  margin: 0 0 6px;
  font-size: 24px;
}

.quick-upload p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.section-grid,
.workspace,
.history-section,
.care-section,
.sources-section {
  padding: 52px clamp(18px, 4vw, 64px);
}

.section-heading {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.section-heading > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #dfeee8;
  color: var(--primary-dark);
  font-weight: 800;
}

.section-heading h2 {
  margin: 0 0 6px;
  font-size: 28px;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.assessment-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 16px;
}

.dimension-card,
.input-pane,
.result-pane,
.trend-board,
.care-section,
.sources-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--card-shadow);
}

.dimension-card {
  padding: 18px;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.dimension-card:hover {
  transform: translateY(-2px);
  border-color: rgba(22, 114, 95, 0.4);
}

.dimension-head {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.dimension-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
}

.dimension-head h3 {
  margin: 0;
  font-size: 18px;
}

.dimension-head p,
.dimension-card p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
}

.module-metrics {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.score-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  margin-top: 14px;
}

.score-line strong {
  font-size: 20px;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: #e8efec;
  overflow: hidden;
  margin-top: 12px;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  width: 0%;
}

.form-actions {
  margin-top: 18px;
}

.analysis-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  gap: 18px;
}

.input-pane,
.result-pane {
  padding: 18px;
}

.input-pane label {
  display: block;
  margin-bottom: 8px;
  color: #34413d;
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 170px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  line-height: 1.6;
  outline: none;
}

textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22, 114, 95, 0.14);
}

.upload-box {
  margin-top: 14px;
  min-height: 126px;
  border: 1px dashed #98aaa4;
  border-radius: 8px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 18px;
  background: #f8fbfa;
  cursor: pointer;
}

.upload-box input {
  display: none;
}

.upload-box span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.6;
}

.file-list {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.file-item,
.history-item,
.source-item,
.hospital-item,
.finding {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.result-pane h3 {
  margin: 0 0 12px;
}

.empty-state {
  min-height: 220px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.risk-high {
  color: var(--red);
}

.risk-mid {
  color: var(--amber);
}

.risk-low {
  color: var(--primary);
}

.trend-board {
  padding: 18px;
}

canvas {
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.history-list,
.source-list,
.hospital-links {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.history-item strong,
.source-item strong,
.hospital-item strong,
.finding strong {
  display: block;
  margin-bottom: 6px;
}

.history-item span,
.source-item span,
.hospital-item span,
.finding span {
  color: var(--muted);
  line-height: 1.6;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chip {
  border-radius: 999px;
  padding: 5px 9px;
  background: #eef5f2;
  color: #28423b;
  font-size: 12px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 22, 18, 0.56);
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 22px;
}

.modal-backdrop[hidden] {
  display: none;
}

.quiz-modal {
  width: min(1040px, 100%);
  max-height: min(860px, 92vh);
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.22);
  border: 1px solid var(--line);
}

.quiz-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.quiz-head p {
  margin: 0 0 5px;
  color: var(--muted);
}

.quiz-head h2 {
  margin: 0;
}

.branch-notice {
  margin: 18px 22px 0;
  padding: 12px;
  border: 1px solid #d8eadf;
  border-radius: 8px;
  background: #f1faf5;
  color: #21493f;
  line-height: 1.6;
}

.evidence-note {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border: 1px solid #d8eadf;
  border-radius: 8px;
  background: #f1faf5;
}

.evidence-note a {
  padding: 6px 8px;
  border-radius: 8px;
  background: #ffffff;
  color: #173f36;
  border: 1px solid #dbece5;
  font-size: 12px;
  font-weight: 800;
}

.quiz-form {
  padding: 18px 22px 0;
  display: grid;
  gap: 12px;
}

.question-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.question-card.branch-question {
  border-color: rgba(188, 122, 29, 0.42);
  background: #fffaf2;
}

.question-title {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: #263832;
  font-weight: 700;
  line-height: 1.5;
}

.question-source {
  margin: 7px 0 0 34px;
  color: var(--muted);
  font-size: 12px;
}

.question-title span {
  color: var(--primary-dark);
  font-variant-numeric: tabular-nums;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.option-grid label {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  cursor: pointer;
}

.option-grid input {
  accent-color: var(--primary);
}

.quiz-actions {
  position: sticky;
  bottom: 0;
  background: #fff;
  padding: 16px 22px 22px;
  border-top: 1px solid var(--line);
  justify-content: flex-end;
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-list {
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    overflow-x: auto;
  }

  .hero,
  .analysis-layout {
    grid-template-columns: 1fr;
  }

  .vital-panel {
    grid-template-columns: 1fr;
  }

  .assessment-grid {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
  }
}

@media (max-width: 760px) {
  .hero {
    min-height: auto;
    padding-top: 36px;
  }

  .hero h1 {
    font-size: 36px;
  }

  .assessment-grid,
  .option-grid {
    grid-template-columns: 1fr;
  }

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

  .nav-list {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
}
