:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #667085;
  --line: #d7dee8;
  --accent: #176b87;
  --accent-2: #5b8c5a;
  --warn: #b45f06;
  --danger: #a94442;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  width: 100%;
  max-width: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  overflow-x: hidden;
}

main {
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 18px clamp(16px, 3vw, 34px);
  background: #fff;
  border-bottom: 1px solid var(--line);
  text-align: center;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(22px, 3vw, 34px);
  letter-spacing: 0;
}

h2 {
  font-size: 19px;
  margin-bottom: 8px;
}

h3 {
  font-size: 16px;
  margin-bottom: 12px;
}

.app-header p,
.muted,
.hint {
  color: var(--muted);
  line-height: 1.55;
}

.ghost-link,
button,
.file-label {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 9px 12px;
  cursor: pointer;
  text-decoration: none;
  font-size: 14px;
}

button.active,
.file-label {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.secondary {
  background: #eef3f7;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px clamp(16px, 3vw, 34px);
  background: #eef3f7;
  border-bottom: 1px solid var(--line);
}

.tab-button {
  white-space: nowrap;
}

.tab-panel {
  display: none;
  min-width: 0;
  max-width: 100%;
}

.tab-panel.active {
  display: block;
}

.tool-grid {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 18px;
  padding: 18px clamp(16px, 3vw, 34px);
}

.tool-grid > *,
.control-panel,
.panel,
.workspace,
.stack {
  min-width: 0;
}

.control-panel,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  max-width: 100%;
}

.control-panel {
  align-self: start;
  position: sticky;
  top: 12px;
}

.stack,
.workspace {
  display: grid;
  gap: 14px;
}

#project3 {
  background: #f6f8fb;
}

#project3 .tool-grid {
  grid-template-columns: minmax(320px, 360px) minmax(0, 1fr);
  align-items: start;
  gap: 20px;
}

#project3 .control-panel {
  max-height: calc(100vh - 98px);
  overflow-y: auto;
  scrollbar-gutter: stable;
}

#project3 .control-panel h2 {
  font-size: 17px;
  margin-bottom: 6px;
}

#project3 .control-panel .muted {
  font-size: 13px;
  margin-bottom: 12px;
}

#project3 .workspace {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.p3-workspace-header {
  padding-bottom: 2px;
}

.p3-workspace-header h2 {
  margin: 0 0 5px;
  font-size: 24px;
  line-height: 1.25;
}

.p3-workspace-header p {
  margin: 0;
  font-size: 13px;
}

.p3-subnav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-self: flex-start;
  gap: 8px;
  max-width: 100%;
  padding: 2px 0 4px;
  overflow-x: visible;
  scrollbar-width: none;
}

.p3-subnav::-webkit-scrollbar {
  display: none;
}

.p3-subtab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  gap: 7px;
  height: 44px;
  min-height: 44px;
  width: auto;
  padding: 0 14px;
  white-space: nowrap;
  border-color: #d9e2eb;
  background: #fff;
  color: #243447;
  box-shadow: none;
  font-weight: 600;
  line-height: 1;
}

.p3-subtab:hover {
  background: #edf7f5;
  border-color: #b8d8d2;
}

#project3 .p3-subnav .p3-subtab.active {
  background: #0f625d;
  border-color: #0f625d;
  color: #fff;
  box-shadow: 0 0 0 3px #c9e7e2, 0 3px 8px rgba(15, 98, 93, 0.2);
  font-weight: 800;
}

#project3 .p3-subnav .p3-subtab.active::before {
  content: "✓";
  font-size: 12px;
  font-weight: 800;
}

#project3 .p3-subnav .p3-subtab:not(.active) {
  border-color: #b8d8d2;
  background: #fff;
  color: #31535a;
}

.advanced-badge {
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 1px 5px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.3;
  opacity: 0.78;
}

.p3-subpanel {
  display: none;
}

.p3-subpanel.active {
  display: grid;
  gap: 12px;
}

.decision-summary-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr) minmax(0, 1.1fr);
  gap: 12px;
}

.decision-card,
.advanced-feature-note,
.research-conclusion-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px 16px;
}

.decision-card h4,
.advanced-feature-note h4,
.research-conclusion-card h4 {
  margin: 0 0 10px;
  font-size: 14px;
}

.decision-card dl {
  display: grid;
  grid-template-columns: minmax(96px, 0.75fr) minmax(0, 1.25fr);
  gap: 7px 12px;
  margin: 0;
  font-size: 13px;
}

.decision-card dt {
  color: var(--muted);
}

.decision-card dd {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.decision-card p,
.advanced-feature-note p,
.research-conclusion-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
}

.summary-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 700;
}

.summary-status.pass {
  background: #e8f3ea;
  color: #2f6b37;
}

.summary-status.warn {
  background: #fff3dc;
  color: #8a4b00;
}

.research-conclusion-card {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 16px;
  align-items: start;
}

.conclusion-block {
  min-width: 0;
}

.conclusion-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.conclusion-block strong {
  display: block;
  margin-bottom: 6px;
  color: #1d2939;
  font-size: 15px;
  line-height: 1.35;
}

.readiness-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
}

.readiness-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #eef2f6;
  padding-bottom: 7px;
}

.readiness-list strong {
  text-align: right;
}

label {
  display: grid;
  gap: 7px;
  margin: 12px 0;
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 9px;
  font: inherit;
  background: #fff;
}

textarea {
  min-height: 132px;
  resize: vertical;
  line-height: 1.45;
}

input[type="file"] {
  display: none;
}

output {
  color: var(--accent);
  font-weight: 700;
}

.hint {
  font-size: 12px;
  margin: 10px 0 4px;
}

.mobile-only {
  display: none;
}

.chart-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.manual-entry {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.design-generator {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.design-generator button {
  width: 100%;
}

.factor-range-grid {
  display: grid;
  grid-template-columns: minmax(104px, 1.25fr) repeat(2, minmax(72px, 0.75fr));
  gap: 7px;
  align-items: center;
  font-size: 12px;
}

.factor-range-grid span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.factor-range-grid input {
  min-width: 0;
  padding: 7px;
  font-size: 12px;
}

.design-summary {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.manual-entry label,
.manual-title {
  margin: 0;
  font-weight: 600;
}

.manual-title {
  font-size: 14px;
}

.manual-entry button {
  width: 100%;
}

.demo-data-panel-host,
.demo-data-panel,
.demo-data-panel * {
  min-width: 0;
}

.demo-data-panel {
  display: grid;
  gap: 10px;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid #cbdbe5;
  border-radius: 8px;
  background: #f8fbfd;
  max-width: 100%;
}

.demo-data-panel__heading h3 {
  margin: 0 0 3px;
  color: #173f53;
  font-size: 15px;
}

.demo-data-panel__heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.demo-data-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.demo-data-actions button {
  width: 100%;
  min-height: 40px;
  padding: 8px 4px;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.demo-data-actions .demo-load-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.demo-data-actions button:disabled,
.demo-modal button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.demo-data-notice {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  margin: 0;
  padding: 10px;
  border-radius: 7px;
  background: #eaf4f8;
  color: #214b5d;
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.demo-data-notice > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #176b87;
  color: #fff;
  font-family: Georgia, serif;
  font-size: 13px;
  font-weight: 700;
}

.demo-data-details {
  color: #344054;
  font-size: 13px;
  line-height: 1.55;
}

.demo-data-details summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 700;
}

.demo-data-details p {
  margin: 8px 0 0;
  overflow-wrap: anywhere;
}

body.demo-modal-open {
  overflow: hidden;
}

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

.demo-modal {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 100%;
  padding: 24px;
  background: rgba(12, 25, 38, 0.56);
}

.demo-modal__surface {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(1100px, 100%);
  max-width: 1100px;
  height: min(85vh, 820px);
  max-height: 85vh;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 24px 64px rgba(16, 24, 40, 0.28);
  outline: none;
}

.demo-modal__header,
.demo-modal__footer {
  position: relative;
  z-index: 2;
  background: #fff;
}

.demo-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}

.demo-modal__header h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.demo-modal__header p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.demo-modal__close {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  font-size: 26px;
  line-height: 1;
}

.demo-modal__toolbar {
  display: flex;
  gap: 8px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.demo-modal__toolbar button {
  min-height: 40px;
}

.demo-modal__toolbar button.active {
  border-color: var(--accent);
  background: #e8f3f7;
  color: #155b73;
}

.demo-modal__body {
  display: grid;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #f7f9fb;
}

.demo-view {
  min-width: 0;
  min-height: 0;
}

.demo-view[hidden] {
  display: none;
}

.demo-view-cards {
  display: grid;
  align-content: start;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.demo-view-table {
  overflow: hidden;
}

.data-table-scroll {
  width: 100%;
  max-width: 100%;
  height: 100%;
  min-width: 0;
  overflow: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.demo-data-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
}

.demo-data-table th,
.demo-data-table td {
  padding: 10px 12px;
  border-right: 1px solid #e5eaf0;
  border-bottom: 1px solid #e5eaf0;
  vertical-align: top;
  white-space: nowrap;
}

.demo-data-table th {
  position: sticky;
  z-index: 1;
  top: 0;
  background: #eef4f7;
  color: #1f3d4d;
  text-align: left;
  box-shadow: 0 1px 0 #d7dee8;
}

.demo-data-table th code,
.demo-data-table th small {
  display: block;
}

.demo-data-table th small {
  margin-top: 4px;
  color: #526579;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 11px;
  font-weight: 400;
}

.demo-data-table td.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.demo-data-table td.textual {
  text-align: left;
}

.demo-record-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.demo-record-card h3 {
  margin: 0 0 10px;
  color: #176b87;
  font-size: 15px;
}

.demo-record-card dl,
.demo-record-card dl > div {
  margin: 0;
}

.demo-record-card dl > div {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.65fr);
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid #edf1f5;
}

.demo-record-card dt,
.demo-record-card dd,
.demo-record-card code,
.demo-record-card small {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.demo-record-card dt code,
.demo-record-card dt small {
  display: block;
}

.demo-record-card dt small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.demo-record-card dd {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.demo-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
}

.demo-modal__footer button {
  min-width: 112px;
  min-height: 42px;
}

.app-toast {
  position: fixed;
  z-index: 1100;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  background: #173f53;
  color: #fff;
  font-size: 14px;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.app-toast[data-type="error"] {
  background: #8a3b3b;
}

.app-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.manual-grid {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.manual-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 12px;
}

.manual-table th,
.manual-table td {
  padding: 6px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.manual-table th {
  color: var(--muted);
  font-weight: 600;
}

.manual-table input {
  min-width: 88px;
  padding: 6px 7px;
  font-size: 12px;
}

.manual-table .row-action {
  width: auto;
  min-width: 56px;
  padding: 6px 8px;
  background: #fff;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
}

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

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.kpi strong {
  font-size: 23px;
}

#project3 .kpi-row {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

#project3 .kpi {
  min-height: 122px;
  display: grid;
  align-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  box-shadow: none;
}

#project3 .kpi span {
  margin-bottom: 0;
  font-weight: 600;
}

#project3 .kpi strong {
  display: block;
  color: #101828;
  font-size: 24px;
  line-height: 1.15;
}

.kpi-value-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
}

.kpi-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.kpi-status.pass {
  background: #e8f3ea;
  color: #2f6b37;
}

.kpi-status.warn {
  background: #fff3dc;
  color: #8a4b00;
}

.kpi-status.danger {
  background: #fdecec;
  color: #9a3412;
}

.kpi-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.chart {
  min-height: 340px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.chart.tall {
  min-height: 410px;
}

.diagnostic-cards,
.metric-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.diagnostic-card,
.metric-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.diagnostic-card h4,
.metric-card h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.metric-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
}

.metric-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #eef2f6;
  padding-bottom: 5px;
}

.metric-list span {
  color: var(--muted);
}

.metric-list strong {
  text-align: right;
}

.analysis-stack {
  display: grid;
  gap: 12px;
}

.analysis-detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.analysis-detail summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  cursor: pointer;
  font-weight: 700;
}

.analysis-detail summary strong {
  color: var(--accent);
}

.analysis-detail summary em {
  color: var(--muted);
  font-style: normal;
  font-weight: 500;
}

.analysis-detail h4 {
  margin: 14px 0 8px;
  font-size: 14px;
}

.analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 14px;
  margin-top: 10px;
}

.impact-bars {
  display: grid;
  gap: 8px;
  margin: 8px 0 12px;
}

.impact-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.1fr) minmax(160px, 1.3fr) 78px;
  gap: 10px;
  align-items: center;
}

.impact-label {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.impact-label strong,
.impact-label span {
  overflow-wrap: anywhere;
}

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

.impact-track {
  height: 16px;
  border-radius: 4px;
  background: #eef2f6;
  overflow: hidden;
}

.impact-track span {
  display: block;
  height: 100%;
}

.impact-track .positive {
  background: var(--accent-2);
}

.impact-track .negative {
  background: var(--warn);
}

.impact-value {
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

.diagnostic-note,
.metric-card p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.diagnostic-chart-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.mini-chart {
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
}

.mini-chart-title {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.split-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.split-charts .chart {
  min-height: 320px;
}

svg {
  display: block;
  width: 100%;
  height: auto;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  margin-top: 8px;
  padding-left: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

#p3Table table {
  min-width: 980px;
}

#p3DesignTable table {
  min-width: 900px;
}

#p3UnmetDetails table {
  min-width: 520px;
}

.candidate-card-list {
  display: none;
}

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

.candidate-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.candidate-card-title {
  font-weight: 700;
}

.candidate-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  font-size: 12px;
}

.candidate-card-grid span {
  display: block;
  color: var(--muted);
  margin-bottom: 2px;
}

.candidate-card-grid strong,
.candidate-card-reason {
  overflow-wrap: anywhere;
}

.candidate-card-reason {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.candidate-card-toggle {
  justify-self: start;
  margin-top: 2px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px;
  text-align: left;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
}

th {
  background: #f2f5f8;
}

#p1ModelTable th:last-child,
#p1ModelTable td:last-child,
#p2AiTable th:last-child,
#p2AiTable td:last-child {
  min-width: 320px;
  white-space: normal;
  line-height: 1.55;
}

#p1ModelTable th:first-child,
#p1ModelTable td:first-child {
  min-width: 230px;
  white-space: normal;
  line-height: 1.45;
}

.model-name {
  font-weight: 600;
}

.model-formula {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.explanation {
  margin: 12px 0 0;
  color: #263445;
  line-height: 1.65;
}

.warning {
  color: var(--danger);
}

.data-note {
  display: none;
  padding: 10px 12px;
  border: 1px solid #f0c36d;
  border-radius: 8px;
  background: #fff8e5;
  color: #7a4a00;
  line-height: 1.55;
  font-size: 13px;
}

.data-note.active {
  display: block;
}

#project3 #p3Explanation {
  display: none;
}

footer {
  padding: 18px clamp(16px, 3vw, 34px);
  color: var(--muted);
}

@media (max-width: 860px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .tool-grid {
    grid-template-columns: 1fr;
    padding-inline: 14px;
  }

  #project3 .tool-grid {
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: static;
  }

  #project3 .control-panel {
    max-height: none;
    overflow-y: visible;
  }

  .kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #project3 .kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart,
  .chart.tall {
    min-height: 300px;
  }

  #p3CandidateChart {
    min-height: 300px;
  }

  .split-charts {
    grid-template-columns: 1fr;
  }

  .diagnostic-cards,
  .metric-guide,
  .diagnostic-chart-grid,
  .analysis-grid,
  .decision-summary-grid {
    grid-template-columns: 1fr;
  }

  .research-conclusion-card {
    grid-template-columns: 1fr;
  }

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

  .impact-value {
    text-align: left;
  }
}

@media (max-width: 768px) {
  .p3-subnav {
    flex-wrap: nowrap;
    align-self: stretch;
    height: 48px;
    min-height: 0;
    padding: 0 0 2px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .p3-subnav::-webkit-scrollbar {
    display: none;
  }

  .p3-subtab {
    height: 42px;
    min-height: 42px;
    padding: 0 12px;
    font-size: 13px;
  }

  .advanced-badge {
    padding: 1px 4px;
    font-size: 9px;
  }

  #project3 .panel {
    padding: 14px;
  }
}

@media (max-width: 520px) {
  #project3 .tool-grid {
    padding-inline: 14px;
  }

  #project3 .workspace {
    overflow-x: hidden;
  }

  .p3-workspace-header h2 {
    font-size: 21px;
  }

  .p3-subtab {
    height: 42px;
    min-height: 42px;
    padding: 0 13px;
  }

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

  #project3 .kpi-row {
    grid-template-columns: 1fr;
  }

  #project3 .kpi {
    min-height: 116px;
  }

  th,
  td {
    padding: 8px 6px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  #project3 .tool-grid {
    padding-inline: 12px;
  }

  #project3 .panel {
    padding: 12px;
  }

  #p3CandidatesPanel {
    gap: 10px;
  }

  #p3CandidateMobileSummary.mobile-only {
    display: grid;
    gap: 10px;
  }

  #p3CandidateChart {
    min-height: 280px;
  }

  #p3Table {
    display: none;
  }

  #p3CandidateCards {
    display: grid;
    gap: 10px;
  }

  .candidate-card-grid {
    grid-template-columns: 1fr;
  }

  .summary-status {
    max-width: 100%;
    border-radius: 8px;
    line-height: 1.35;
  }
}

@media (min-width: 900px) {
  #project3 .tool-grid {
    grid-template-columns: minmax(320px, 360px) minmax(0, 1fr);
  }

  #project3 .control-panel {
    position: sticky;
    top: 12px;
    max-height: calc(100vh - 98px);
    overflow-y: auto;
  }

  #project3 .kpi-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  #project3 .split-charts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #project3 .diagnostic-cards,
  #project3 .metric-guide,
  #project3 .diagnostic-chart-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #project3 .analysis-grid {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  }

  #project3 .decision-summary-grid {
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr) minmax(0, 1.1fr);
  }

  #project3 .research-conclusion-card {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  }

  #project3 .impact-row {
    grid-template-columns: minmax(150px, 1.1fr) minmax(160px, 1.3fr) 78px;
  }

  #project3 .impact-value {
    text-align: right;
  }

  #project3 .p3-subnav {
    flex-wrap: wrap;
    align-self: flex-start;
    height: auto;
    min-height: 0;
    padding: 2px 0 4px;
    overflow-x: visible;
    overflow-y: visible;
  }

  #project3 .p3-subtab {
    height: 44px;
    min-height: 44px;
    padding: 0 14px;
    font-size: 14px;
  }

  #project3 .advanced-badge {
    padding: 1px 5px;
    font-size: 10px;
  }

  #project3 .panel {
    padding: 16px;
  }

  #project3 .chart,
  #project3 .chart.tall,
  #project3 #p3CandidateChart {
    min-height: 340px;
  }
}

@media (max-width: 899px) {
  html, body { overflow-x: hidden; }
  #project3, #project3 *, #project3 *::before, #project3 *::after { box-sizing: border-box; }
  #project3, #project3 .tool-grid, #project3 .workspace, #project3 .panel { width: 100%; max-width: 100%; min-width: 0; }
  #project3 .tool-grid { display: flex; flex-direction: column; gap: 12px; padding: 14px 12px 24px; }
  #project3 .p3-mobile-header { display: block; order: 1; }
  #project3 .p3-mobile-header h2 { margin: 0 0 6px; font-size: clamp(21px, 6vw, 27px); line-height: 1.25; overflow: visible; }
  #project3 .p3-mobile-header p { margin: 0; color: #526579; font-size: 14px; line-height: 1.55; }
  #project3 .control-panel { order: 2; position: static; max-height: none; overflow: visible; padding: 14px; }
  #project3 .control-panel > h2 { margin: 0 0 4px; font-size: 17px; }
  #project3 .control-panel > .muted { display: none; }
  #project3 .p3-mobile-target-summary { display: grid; gap: 6px; margin: 10px 0; }
  #project3 .p3-mobile-target-summary span { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
  #project3 .p3-control-toggle { display: block; width: 100%; min-height: 44px; font-size: 14px; }
  #project3 .p3-control-details { display: none; max-height: 68vh; margin-top: 12px; overflow-y: auto; overflow-x: hidden; }
  #project3 .p3-control-details.open { display: block; }
  #project3 .manual-entry, #project3 .manual-grid { max-width: 100%; min-width: 0; overflow-x: auto; }
  #project3 .workspace { order: 3; gap: 12px; overflow: visible; }
  #project3 .p3-workspace-header { display: none; }
  #project3 .p3-subnav { display: flex; flex-wrap: nowrap; width: 100%; height: 46px; min-height: 46px; padding: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
  #project3 .p3-subtab { flex: 0 0 auto; width: auto; height: 44px; min-height: 44px; padding: 0 14px; white-space: nowrap; font-size: 14px; }
  #project3 .advanced-badge { display: none; }
  #project3 .decision-summary-grid, #project3 .research-conclusion-card, #project3 .diagnostic-cards, #project3 .metric-guide, #project3 .analysis-grid { grid-template-columns: 1fr; }
  #project3 .kpi-row { grid-template-columns: 1fr; }
  #project3 .kpi { min-height: 0; }
  #project3 .kpi strong { font-size: 26px; }
  #project3 .panel { padding: 14px; }
  #project3 #p3Explanation { display: none; }
  #project3 #p3CandidateMobileSummary.mobile-only, #project3 #p3CandidateCards { display: block; }
  #project3 .candidate-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #project3 .candidate-card-grid span { min-width: 0; word-break: keep-all; }
  #project3 .p3-mobile-table-details > summary, #project3 .p3-diagnostic-details > summary { cursor: pointer; padding: 12px; border-radius: 8px; background: #eef5f8; color: #176b87; font-weight: 700; font-size: 13px; }
  #project3 .table-wrap { width: 100%; max-width: 100%; overflow-x: auto; }
  #project3 table { min-width: 720px; }
  #project3 svg, #project3 canvas, #project3 img { max-width: 100%; }
  #project3 .chart, #project3 .chart.tall, #project3 #p3CandidateChart { width: 100%; min-height: 280px; height: 280px; overflow: hidden; }
  #project3 .diagnostic-chart-grid { grid-template-columns: 1fr; }
  #project3 .analysis-detail:not([open]) { display: block; }
  #project3 .analysis-detail summary em::after { content: " · 专业统计明细，建议电脑端查看"; }
  #project3 { font-size: 13px; }
}

@media (min-width: 900px) {
  #project3 .p3-mobile-table-details, #project3 .p3-diagnostic-details { display: contents; }
  #project3 .p3-mobile-table-details > summary, #project3 .p3-diagnostic-details > summary { display: none; }
}

/* Project 3 因素影响：桌面保留完整统计表，手机使用独立摘要视图。 */
#project3 .p3-factor-mobile {
  display: none;
}

#project3 .p3-factor-desktop {
  display: grid;
  gap: 12px;
}

@media (max-width: 767px) {
  #project3,
  #project3 .workspace,
  #project3 #p3FactorsPanel,
  #project3 #p3FactorsPanel .panel,
  #project3 #p3ModelSelectionAnova,
  #project3 .p3-factor-mobile,
  #project3 .p3-mobile-section,
  #project3 .p3-response-card,
  #project3 .p3-research-card,
  #project3 .p3-professional-details,
  #project3 .p3-professional-panel,
  #project3 .p3-stat-card,
  #project3 .p3-impact-card,
  #project3 .table-scroll {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  html,
  body,
  #project3 {
    overflow-x: hidden;
  }

  #project3 #p3FactorsPanel,
  #project3 #p3FactorsPanel .panel,
  #project3 #p3ModelSelectionAnova,
  #project3 .p3-factor-mobile,
  #project3 .p3-mobile-response-panel,
  #project3 .p3-professional-details,
  #project3 .p3-professional-body,
  #project3 .p3-professional-panel,
  #project3 .p3-control-details,
  #project3 .control-panel {
    height: auto;
    max-height: none;
    overflow: visible;
    overflow-y: visible;
  }

  #project3 .p3-factor-desktop {
    display: none;
  }

  #project3 .p3-factor-mobile {
    display: grid;
    gap: 16px;
  }

  #project3 #p3FactorsPanel .panel {
    padding: 14px;
  }

  #project3 #p3FactorsPanel .panel > h3 {
    margin: 0 0 14px;
    font-size: 19px;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #project3 .p3-risk-note {
    width: 100%;
    max-width: 100%;
    padding: 13px 16px;
    border: 1px solid #f0c36d;
    border-radius: 10px;
    background: #fff8e5;
    color: #7a4a00;
    font-size: 13px;
    line-height: 1.6;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    box-sizing: border-box;
  }

  #project3 .p3-mobile-section {
    display: grid;
    gap: 10px;
  }

  #project3 .p3-mobile-section h4,
  #project3 .p3-research-card h4 {
    margin: 0;
    font-size: 16px;
    line-height: 1.4;
  }

  #project3 .p3-response-card-list,
  #project3 .p3-stat-card-list,
  #project3 .p3-mobile-impact-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  #project3 .p3-response-card {
    display: grid;
    gap: 7px;
    min-height: 0;
    padding: 14px 16px;
    border: 1px solid #d7e0e8;
    border-radius: 12px;
    background: #fff;
    color: #263445;
    text-align: left;
    box-shadow: none;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #project3 .p3-response-card:hover {
    transform: none;
    box-shadow: none;
  }

  #project3 .p3-response-card.active {
    border: 2px solid var(--accent);
    background: #eef8fb;
  }

  #project3 .p3-response-card .p3-response-name {
    color: var(--accent);
    font-size: 16px;
    font-weight: 800;
  }

  #project3 .p3-response-card > span:not(.p3-response-name) {
    display: grid;
    grid-template-columns: minmax(92px, 0.8fr) minmax(0, 1.2fr);
    gap: 12px;
    align-items: start;
    font-size: 13px;
    line-height: 1.45;
  }

  #project3 .p3-response-card b {
    color: var(--muted);
    font-weight: 600;
  }

  #project3 .p3-response-card small {
    padding-top: 7px;
    border-top: 1px solid #dde9ee;
    color: #526579;
    font-size: 12px;
    line-height: 1.55;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #project3 .p3-mobile-response-panel:not(.active) {
    display: none;
  }

  #project3 .p3-mobile-response-panel.active {
    display: grid;
    gap: 16px;
  }

  #project3 .p3-impact-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    padding: 12px;
    border: 1px solid #e1e8ee;
    border-radius: 10px;
    background: #fff;
  }

  #project3 .p3-impact-card-head {
    display: grid;
    gap: 3px;
    min-width: 0;
  }

  #project3 .p3-impact-card-head strong,
  #project3 .p3-impact-card-head span {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #project3 .p3-impact-card-head span {
    color: var(--muted);
    font-size: 12px;
  }

  #project3 .p3-impact-card-value {
    align-self: start;
    color: #263445;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
  }

  #project3 .p3-impact-card .impact-track {
    grid-column: 1 / -1;
    width: 100%;
    max-width: 100%;
    height: 10px;
  }

  #project3 .p3-extra-impact,
  #project3 .p3-extra-coefficient {
    display: none;
  }

  #project3 .show-all .p3-extra-impact,
  #project3 .show-all .p3-extra-coefficient {
    display: grid;
  }

  #project3 .p3-inline-toggle {
    width: 100%;
    min-height: 42px;
    margin: 0;
    border: 1px solid #b8d3dd;
    background: #f4fafc;
    color: var(--accent);
    font-size: 13px;
    box-shadow: none;
  }

  #project3 .p3-research-card {
    padding: 16px;
    border: 1px solid #dce7e1;
    border-radius: 12px;
    background: #f5faf7;
  }

  #project3 .p3-research-card p {
    margin: 8px 0 0;
    color: #334b3e;
    font-size: 14px;
    line-height: 1.7;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #project3 .p3-professional-details {
    border: 1px solid #cfdbe3;
    border-radius: 12px;
    background: #fff;
  }

  #project3 .p3-professional-details > summary,
  #project3 .p3-professional-panel > summary {
    cursor: pointer;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #project3 .p3-professional-details > summary {
    padding: 15px 16px;
    color: #176b87;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.5;
  }

  #project3 .p3-professional-body {
    display: grid;
    gap: 10px;
    padding: 0 12px 12px;
  }

  #project3 .p3-professional-panel {
    border: 1px solid #e1e8ee;
    border-radius: 10px;
    background: #fbfcfd;
  }

  #project3 .p3-professional-panel > summary {
    padding: 13px 14px;
    font-weight: 700;
    line-height: 1.45;
  }

  #project3 .p3-professional-panel > .p3-stat-card-list,
  #project3 .p3-professional-panel > .p3-inline-toggle {
    margin: 0 12px 12px;
    width: calc(100% - 24px);
    max-width: calc(100% - 24px);
  }

  #project3 .p3-stat-card {
    padding: 13px;
    border: 1px solid #dfe7ed;
    border-radius: 10px;
    background: #fff;
  }

  #project3 .p3-stat-card.selected {
    border-color: var(--accent);
    background: #f0f9fb;
  }

  #project3 .p3-stat-card header {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 10px;
  }

  #project3 .p3-stat-card h6 {
    margin: 0 0 10px;
    min-width: 0;
    color: #263445;
    font-size: 14px;
    line-height: 1.45;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #project3 .p3-stat-card header h6 {
    margin: 0;
  }

  #project3 .p3-selected-badge {
    flex: 0 0 auto;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
  }

  #project3 .p3-card-kv-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1px;
    overflow: hidden;
    border: 1px solid #e7edf1;
    border-radius: 8px;
    background: #e7edf1;
  }

  #project3 .p3-mobile-kv {
    display: grid;
    gap: 5px;
    min-width: 0;
    padding: 9px;
    background: #fff;
  }

  #project3 .p3-mobile-kv span {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #project3 .p3-mobile-kv strong {
    min-width: 0;
    color: #263445;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    line-height: 1.45;
    text-align: right;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #project3 .p3-coefficient-card .p3-mobile-kv:nth-child(5) {
    grid-column: 1 / -1;
  }

  #project3 .p3-card-note {
    margin: 9px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #project3 .metric-unavailable {
    color: #7b8794;
  }

  #project3 .p3-unavailable-line {
    padding: 10px 0 2px;
    font-size: 18px;
  }

  #project3 .table-scroll,
  #project3 #p3FactorsPanel .table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  #project3 .p3-subnav {
    width: 100%;
    max-width: 100%;
    padding: 0 16px;
    scroll-padding-inline: 16px;
    overscroll-behavior-inline: contain;
    overflow-x: auto;
    overflow-y: hidden;
  }

  #project3 .p3-subnav::-webkit-scrollbar {
    display: none;
  }
}

@media (min-width: 768px) {
  #project3 .p3-factor-mobile {
    display: none;
  }

  #project3 .p3-factor-desktop {
    display: grid;
  }
}

@media (max-width: 767px) {
  .tool-grid,
  .tool-grid > *,
  .control-panel,
  .workspace,
  .panel,
  .demo-data-panel-host,
  .demo-data-panel,
  .demo-modal,
  .demo-modal__surface,
  .demo-modal__body,
  .demo-view,
  .data-table-scroll {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .tool-grid {
    padding: 14px;
  }

  .control-panel,
  .panel {
    padding: 14px;
  }

  .demo-data-panel {
    padding: 14px;
  }

  .demo-data-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .demo-data-actions .demo-load-button {
    grid-column: 1 / -1;
  }

  .demo-data-actions button {
    min-height: 44px;
    padding-inline: 8px;
    font-size: 13px;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .demo-modal {
    place-items: stretch;
    padding: 0;
    background: #fff;
  }

  .demo-modal__surface {
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .demo-modal__header {
    padding: calc(12px + env(safe-area-inset-top)) 14px 12px;
  }

  .demo-modal__header h2 {
    font-size: 18px;
    overflow-wrap: anywhere;
  }

  .demo-modal__header p {
    font-size: 13px;
  }

  .demo-modal__close {
    flex-basis: 44px;
    width: 44px;
    height: 44px;
  }

  .demo-modal__toolbar {
    padding: 8px 14px;
  }

  .demo-modal__toolbar button {
    flex: 1 1 0;
    min-height: 44px;
  }

  .demo-view-cards {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px 14px;
  }

  .demo-record-card {
    padding: 14px;
  }

  .demo-record-card dl > div {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  }

  .demo-modal__footer {
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  }

  .demo-modal__footer button {
    flex: 1 1 0;
    min-width: 0;
    min-height: 44px;
  }
}

@media (max-width: 350px) {
  .tool-grid {
    padding-inline: 12px;
  }

  .demo-data-actions {
    grid-template-columns: 1fr;
  }

  .demo-data-actions .demo-load-button {
    grid-column: auto;
  }

  .demo-record-card dl > div {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .demo-record-card dd {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Phase 1-2 platform shell and decision homepage */
:root {
  --bg: #f6f8fa;
  --panel: #ffffff;
  --ink: #172b34;
  --muted: #60717a;
  --line: #dbe3e7;
  --accent: #176b72;
  --accent-soft: #eaf5f4;
  --accent-2: #557c68;
  --warn: #9a6200;
  --danger: #a33a3a;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(27, 55, 66, 0.06);
  --content-width: 1240px;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 0;
  line-height: 1.6;
}

button,
.file-label,
input,
select {
  min-height: 44px;
}

button {
  font-weight: 700;
}

button:not(.secondary):not(.text-button):not(.icon-button):not(.tab-button):not(.back-home) {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(23, 107, 114, 0.24);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-header {
  position: sticky;
  z-index: 40;
  top: 0;
  justify-content: flex-start;
  min-height: 68px;
  padding-block: 12px;
  text-align: left;
}

.brand {
  display: grid;
  gap: 1px;
}

.brand strong {
  color: var(--ink);
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.35;
}

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

.mobile-nav-toggle,
.mobile-nav-head,
.nav-backdrop {
  display: none;
}

.tabs {
  position: sticky;
  z-index: 35;
  top: 68px;
  justify-content: center;
  padding: 10px clamp(16px, 3vw, 34px);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 4px 14px rgba(27, 55, 66, 0.04);
}

.tab-button {
  min-height: 40px;
  border-color: transparent;
  background: transparent;
  color: #40545d;
}

.tab-button.active {
  background: var(--accent-soft);
  border-color: #bdd9d7;
  color: var(--accent);
}

.page-container,
.module-page-header,
.tool-grid {
  width: min(100%, var(--content-width));
  margin-inline: auto;
}

.page-container {
  padding: clamp(24px, 4vw, 52px) clamp(16px, 3vw, 34px);
}

.module-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 26px clamp(16px, 3vw, 34px) 8px;
}

.module-page-header > div {
  max-width: 820px;
}

.module-page-header h1 {
  margin: 6px 0 8px;
  font-size: clamp(24px, 3.4vw, 36px);
  line-height: 1.25;
}

.module-page-header p {
  margin-bottom: 0;
  color: var(--muted);
}

.module-page-header .term-line {
  margin-top: 8px;
  font-size: 13px;
}

.module-page-header.standalone {
  width: 100%;
  padding: 0 0 22px;
}

.back-home {
  min-height: 36px;
  margin-bottom: 10px;
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: var(--accent);
}

.eyebrow,
.card-kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.data-source-tag,
.status-tag {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid #c9dcda;
  border-radius: 999px;
  background: #f1f8f7;
  color: #38665f;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.tool-grid {
  padding-top: 16px;
}

.control-panel,
.panel,
.content-card,
.method-card,
.next-stage-card {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.home-page {
  display: grid;
  gap: clamp(54px, 7vw, 84px);
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: clamp(26px, 5vw, 68px);
  align-items: center;
  min-height: 440px;
}

.home-hero h1 {
  max-width: 820px;
  margin: 10px 0 16px;
  font-size: clamp(34px, 4.5vw, 54px);
  line-height: 1.14;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.hero-subtitle {
  max-width: 720px;
  margin-bottom: 12px;
  color: #344b54;
  font-size: clamp(18px, 2.2vw, 23px);
  line-height: 1.65;
}

.hero-method {
  max-width: 720px;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.text-button {
  border-color: transparent;
  background: transparent;
  color: var(--accent);
}

.scope-card {
  padding: 24px;
  border: 1px solid #cfe1df;
  border-radius: var(--radius);
  background: linear-gradient(155deg, #f4faf9, #fff);
  box-shadow: var(--shadow);
}

.scope-card h2 {
  margin: 18px 0 8px;
  font-size: 19px;
}

.scope-card p {
  margin: 0;
  color: #496169;
}

.home-section {
  display: grid;
  gap: 24px;
  scroll-margin-top: 145px;
}

.section-heading {
  max-width: 760px;
}

.section-heading h2 {
  margin: 7px 0 8px;
  font-size: clamp(25px, 3vw, 34px);
}

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

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

.module-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.module-index {
  color: #88a0a5;
  font-size: 12px;
  font-weight: 800;
}

.module-card h3 {
  min-height: 52px;
  margin: 10px 0 8px;
  font-size: 18px;
  line-height: 1.45;
}

.module-card p {
  flex: 1;
  color: var(--muted);
  font-size: 14px;
}

.module-card button {
  width: 100%;
  margin-top: 18px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag-list span {
  padding: 4px 8px;
  border-radius: 6px;
  background: #eef4f4;
  color: #4e666d;
  font-size: 12px;
}

.tag-list.spacious {
  gap: 9px;
}

.tag-list.spacious span {
  padding: 7px 10px;
}

.experience-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

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

.experience-card.learning {
  border-style: dashed;
  background: #fbfcfc;
}

.experience-label {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.experience-card h3 {
  margin: 6px 0 14px;
  font-size: 20px;
}

.experience-card ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 22px;
  margin: 0;
  padding-left: 20px;
}

.boundary-note {
  margin: 16px 0 0;
  padding: 10px 12px;
  border-left: 3px solid #d3a54a;
  background: #fff9ed;
  color: #6f561f;
  font-size: 13px;
}

.process-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.process-flow li {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 14px 12px;
  text-align: center;
}

.process-flow li:not(:last-child)::after {
  position: absolute;
  top: 31px;
  right: -12px;
  content: "→";
  color: #8ba0a5;
  font-size: 22px;
}

.process-flow span {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
}

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

.glossary-grid p {
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
}

.disclaimer {
  padding: 18px 20px;
  border: 1px solid #d5dee2;
  border-radius: var(--radius);
  background: #f2f5f6;
  color: #4e6068;
}

.disclaimer p {
  margin: 5px 0 0;
}

.module-disclaimer {
  width: min(calc(100% - 32px), calc(var(--content-width) - 68px));
  margin: 0 auto 28px;
}

.chart-interpretation {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f5f8f8;
  color: var(--muted);
  font-size: 13px;
}

.bio-page {
  display: grid;
  gap: 28px;
}

.scope-banner {
  padding: 16px 18px;
  border: 1px solid #ead6a6;
  border-radius: var(--radius);
  background: #fffaf0;
  color: #6f5823;
}

.scope-banner p {
  margin: 4px 0 0;
}

.placeholder-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.content-card {
  padding: 24px;
  border: 1px solid var(--line);
  background: #fff;
}

.content-card h2 {
  margin: 6px 0 16px;
}

.method-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.method-card {
  padding: 20px;
  border: 1px solid var(--line);
  background: #fff;
}

.method-card h3 {
  margin-bottom: 7px;
}

.method-card p {
  color: var(--muted);
  font-size: 14px;
}

.method-card span {
  display: block;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: #7a672f;
  font-size: 11px;
}

.next-stage-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px;
  border: 1px solid #cfe1df;
  background: #f4faf9;
}

.next-stage-card h2 {
  margin: 8px 0 5px;
}

.next-stage-card p {
  margin: 0;
  color: var(--muted);
}

.status-tag.neutral {
  background: #fff;
}

footer {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  background: #fff;
  text-align: center;
}

@media (max-width: 1100px) {
  .module-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .method-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  html.nav-open,
  body.nav-open {
    overflow: hidden;
  }

  .app-header {
    top: 0;
    min-height: 62px;
    padding: 9px 14px;
  }

  .mobile-nav-toggle {
    display: inline-grid;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    min-height: 44px;
    place-items: center;
    padding: 0;
    border-color: var(--line);
    background: #fff;
    color: var(--ink);
    font-size: 20px;
  }

  .brand span {
    display: none;
  }

  .tabs {
    position: fixed;
    z-index: 60;
    top: 0;
    bottom: 0;
    left: 0;
    display: flex;
    width: min(86vw, 330px);
    padding: 0 14px 20px;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 6px;
    overflow-y: auto;
    background: #fff;
    border-right: 1px solid var(--line);
    transform: translateX(-105%);
    transition: transform 180ms ease;
    box-shadow: 14px 0 36px rgba(27, 55, 66, 0.16);
  }

  .tabs.open {
    transform: translateX(0);
  }

  .mobile-nav-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 66px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--line);
  }

  .icon-button {
    width: 44px;
    min-height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--ink);
    font-size: 27px;
  }

  .tab-button {
    width: 100%;
    min-height: 48px;
    text-align: left;
    white-space: normal;
  }

  .nav-backdrop {
    position: fixed;
    z-index: 55;
    inset: 0;
    display: block;
    background: rgba(20, 36, 42, 0.38);
  }

  .page-container {
    padding: 28px 14px;
  }

  .home-page {
    gap: 54px;
  }

  .home-hero {
    grid-template-columns: 1fr;
    gap: 24px;
    min-height: 0;
  }

  .home-hero h1 {
    margin-top: 7px;
    font-size: clamp(31px, 10.5vw, 44px);
  }

  .hero-subtitle {
    font-size: 18px;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .hero-actions button {
    width: 100%;
  }

  .module-card-grid,
  .experience-grid,
  .placeholder-grid,
  .method-card-grid,
  .glossary-grid {
    grid-template-columns: 1fr;
  }

  .module-card h3 {
    min-height: 0;
  }

  .experience-card ul {
    grid-template-columns: 1fr;
  }

  .process-flow {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .process-flow li {
    grid-template-columns: 36px minmax(0, 1fr);
    align-items: center;
    justify-items: start;
    text-align: left;
  }

  .process-flow li:not(:last-child)::after {
    top: auto;
    right: auto;
    bottom: -13px;
    left: 24px;
    content: "↓";
    font-size: 18px;
  }

  .module-page-header {
    display: grid;
    gap: 14px;
    padding: 24px 14px 4px;
  }

  .module-page-header.standalone {
    padding: 0 0 18px;
  }

  .module-page-header .data-source-tag {
    justify-self: start;
    white-space: normal;
  }

  .tool-grid {
    padding: 14px;
  }

  .kpi-row,
  #project3 .kpi-row {
    grid-template-columns: 1fr;
  }

  #project1 .control-panel,
  #project2 .control-panel {
    position: static;
  }

  #p1ModelTable table,
  #p2AiTable table {
    min-width: 0;
    table-layout: fixed;
  }

  #p1ModelTable th,
  #p1ModelTable td,
  #p2AiTable th,
  #p2AiTable td {
    min-width: 0 !important;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #project3 .p3-mobile-header {
    display: none;
  }

  #project3 .p3-control-details {
    max-height: none;
    overflow: visible;
  }

  #project3 #p3Table,
  #project3 .p3-mobile-table-details {
    display: none;
  }

  #project3 #p3CandidateCards {
    display: grid;
    gap: 10px;
  }

  #project3 .candidate-card-grid {
    grid-template-columns: 1fr;
  }

  .next-stage-card {
    align-items: stretch;
    flex-direction: column;
  }

  .next-stage-card button {
    width: 100%;
  }
}

/* Phase 3: biological product quality assessment */
#project4 {
  background: var(--bg);
}

.bio-page {
  gap: clamp(34px, 5vw, 58px);
}

.bio-section {
  display: grid;
  gap: 20px;
  min-width: 0;
  scroll-margin-top: 140px;
}

.bio-setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 18px;
  align-items: start;
}

.bio-case-card,
.bio-target-card {
  display: grid;
  gap: 15px;
}

.bio-case-card h2,
.bio-target-card h2 {
  margin: 4px 0 0;
}

.bio-case-card > label {
  display: grid;
  gap: 6px;
  color: #31474f;
  font-size: 13px;
  font-weight: 700;
}

.bio-case-card label small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.bio-data-source {
  padding: 14px;
  border: 1px solid #d8e6e4;
  border-radius: 10px;
  background: #f5faf9;
}

.bio-data-source p {
  margin: 9px 0 6px;
  color: var(--muted);
  font-size: 12px;
}

.bio-data-source strong {
  color: #365a59;
  font-size: 12px;
}

.bio-target-card > p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.bio-target-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.bio-target-grid label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 8px;
  min-width: 0;
  color: #40545d;
  font-size: 12px;
  font-weight: 700;
}

.bio-target-grid label span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.bio-target-grid input {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
}

.bio-data-actions,
.bio-summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.bio-batch-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  min-width: 0;
}

.bio-batch-editor {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.bio-batch-editor > header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: #f7faf9;
}

.bio-batch-editor > header label {
  display: grid;
  flex: 1;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.bio-batch-editor > header input {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
}

.bio-remove-batch {
  flex: 0 0 auto;
}

.bio-batch-editor details {
  border-bottom: 1px solid var(--line);
}

.bio-batch-editor details:last-child {
  border-bottom: 0;
}

.bio-batch-editor summary {
  cursor: pointer;
  padding: 13px 16px;
  color: #31575b;
  font-size: 13px;
  font-weight: 800;
}

.bio-batch-editor details[open] summary {
  border-bottom: 1px solid #edf1f2;
}

.bio-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
}

.bio-field {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
}

.bio-field > span {
  color: #324950;
  font-size: 12px;
  font-weight: 800;
}

.bio-field > span small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.bio-field input,
.bio-field select {
  width: 100%;
  min-width: 0;
}

.bio-field em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  line-height: 1.45;
}

.bio-error {
  margin: 0;
}

.bio-run-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
  border: 1px solid #bcd7d4;
  border-radius: var(--radius);
  background: #eef8f7;
}

.bio-run-bar > div {
  display: grid;
  gap: 3px;
}

.bio-run-bar span {
  color: var(--muted);
  font-size: 12px;
}

#bioRunAnalysis {
  min-width: 180px;
}

#bioRunAnalysis:disabled {
  cursor: wait;
  opacity: 0.65;
}

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

.bio-kpi {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.bio-kpi span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.bio-kpi strong {
  min-width: 0;
  color: var(--ink);
  font-size: clamp(22px, 3vw, 29px);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.bio-kpi small {
  color: #597078;
  font-size: 11px;
  line-height: 1.45;
}

.bio-decision-card {
  padding: 18px 20px;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: #f3f9f8;
  color: #314b51;
}

.bio-decision-card p {
  margin: 6px 0 0;
}

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

.bio-grouped-metrics article {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.bio-grouped-metrics span,
.bio-grouped-metrics small {
  color: var(--muted);
  font-size: 10px;
}

.bio-grouped-metrics strong {
  color: #2c4b50;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.bio-desktop-table table {
  min-width: 1080px;
}

.bio-desktop-table th:last-child,
.bio-desktop-table td:last-child {
  min-width: 270px;
  white-space: normal;
}

.status-tag.pass {
  border-color: #bbd9c0;
  background: #edf7ef;
  color: #35683d;
}

.status-tag.warn {
  border-color: #ead19b;
  background: #fff8e8;
  color: #865b08;
}

.status-tag.danger {
  border-color: #e7b9b9;
  background: #fff1f1;
  color: #923737;
}

.bio-mobile-cards {
  display: none;
}

.bio-batch-result-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.bio-batch-result-card > header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.bio-batch-result-card header span:not(.status-tag) {
  color: var(--muted);
  font-size: 10px;
}

.bio-batch-result-card h3 {
  margin: 2px 0 0;
  font-size: 19px;
}

.bio-score-line {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0;
  padding: 11px 12px;
  border-radius: 9px;
  background: var(--accent-soft);
}

.bio-score-line span {
  color: #45676a;
  font-size: 12px;
}

.bio-score-line strong {
  color: var(--accent);
  font-size: 24px;
}

.bio-batch-result-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin: 0;
  border: 1px solid #e3e9eb;
  border-radius: 9px;
  background: #e3e9eb;
}

.bio-batch-result-card dl div {
  display: grid;
  gap: 3px;
  padding: 9px;
  background: #fff;
}

.bio-batch-result-card dt {
  color: var(--muted);
  font-size: 10px;
}

.bio-batch-result-card dd {
  margin: 0;
  font-weight: 800;
}

.bio-batch-result-card > p,
.bio-batch-result-card details p {
  color: #4c6169;
  font-size: 12px;
  line-height: 1.55;
}

.bio-batch-result-card details {
  margin-top: 10px;
}

.bio-batch-result-card summary {
  cursor: pointer;
  min-height: 42px;
  padding: 9px 0;
  color: var(--accent);
  font-weight: 800;
}

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

.bio-risk-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.bio-risk-rank {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: #f0f4f5;
  color: #5b6f76;
  font-weight: 800;
}

.bio-risk-row p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.bio-risk-row > b {
  color: #844a2c;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.bio-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.bio-chart-panel {
  min-width: 0;
}

.bio-chart-panel:last-child {
  grid-column: 1 / -1;
}

.bio-chart {
  min-height: 290px;
  overflow: visible;
}

.bio-chart svg {
  width: 100%;
  height: auto;
  max-width: 100%;
}

.bio-chart-data {
  display: none;
}

.bio-method-card dl {
  display: grid;
  gap: 9px;
  margin: 0 0 13px;
}

.bio-method-card dl div {
  display: grid;
  gap: 2px;
}

.bio-method-card dt {
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
}

.bio-method-card dd {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.bio-summary-actions {
  align-items: center;
}

#bioCopyStatus {
  color: #38704b;
  font-size: 12px;
  font-weight: 700;
}

.bio-summary-output {
  width: 100%;
  max-width: 100%;
  min-height: 250px;
  max-height: 520px;
  margin: 0;
  padding: 18px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: #30474f;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 13px;
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.empty-state {
  width: 100%;
  padding: 24px;
  border: 1px dashed #c9d4d8;
  border-radius: var(--radius);
  background: #f8fafb;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1100px) {
  .bio-batch-editor-grid,
  .bio-chart-grid {
    grid-template-columns: 1fr;
  }

  .bio-chart-panel:last-child {
    grid-column: auto;
  }

  .bio-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bio-grouped-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  #project4,
  #project4 *,
  #project4 *::before,
  #project4 *::after {
    box-sizing: border-box;
  }

  #project4,
  #project4 .bio-page,
  #project4 .bio-section,
  #project4 .bio-setup-grid,
  #project4 .bio-batch-editor-grid,
  #project4 .bio-batch-editor,
  #project4 .bio-field-grid,
  #project4 .bio-chart-grid,
  #project4 .bio-chart-panel,
  #project4 .bio-chart,
  #project4 .bio-summary-output {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .bio-setup-grid,
  .bio-batch-editor-grid,
  .bio-chart-grid,
  .bio-kpi-grid,
  .bio-grouped-metrics {
    grid-template-columns: 1fr;
  }

  .bio-target-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bio-data-actions,
  .bio-summary-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bio-data-actions button:first-child,
  .bio-summary-actions button:first-child,
  #bioCopyStatus {
    grid-column: 1 / -1;
  }

  .bio-data-actions button,
  .bio-summary-actions button {
    width: 100%;
    min-width: 0;
    white-space: normal;
  }

  .bio-batch-editor > header {
    align-items: stretch;
    flex-direction: column;
  }

  .bio-remove-batch {
    width: 100%;
  }

  .bio-field-grid {
    grid-template-columns: 1fr;
  }

  .bio-run-bar {
    align-items: stretch;
    flex-direction: column;
  }

  #bioRunAnalysis {
    width: 100%;
    min-width: 0;
  }

  .bio-desktop-table {
    display: none;
  }

  .bio-mobile-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .bio-risk-row {
    grid-template-columns: 30px minmax(0, 1fr) auto;
    padding: 12px;
  }

  .bio-risk-row > b {
    font-size: 17px;
  }

  .bio-chart {
    min-height: 0;
  }

  .bio-chart .chart-legend {
    justify-content: flex-start;
    padding: 0;
  }

  .bio-chart-data {
    display: grid;
    gap: 6px;
    margin-top: 10px;
  }

  .bio-chart-data p {
    margin: 0;
    padding: 8px 10px;
    border-radius: 7px;
    background: #f5f8f8;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
  }

  .bio-summary-output {
    min-height: 320px;
    max-height: 70vh;
    padding: 14px;
    font-size: 12px;
  }
}

@media (max-width: 390px) {
  .bio-target-grid {
    grid-template-columns: 1fr;
  }

  .bio-data-actions,
  .bio-summary-actions {
    grid-template-columns: 1fr;
  }

  .bio-data-actions button:first-child,
  .bio-summary-actions button:first-child,
  #bioCopyStatus {
    grid-column: auto;
  }
}

@media print {
  .app-header,
  .tabs,
  .bio-data-actions,
  .bio-run-bar,
  .bio-summary-actions,
  footer {
    display: none !important;
  }

  #project4 {
    display: block !important;
  }

  #project4 .bio-section,
  #project4 .content-card,
  #project4 .panel {
    break-inside: avoid;
    box-shadow: none;
  }
}

/* Phase 4: stability case switch and biological stability simulation */
.p2-case-switch-wrap {
  width: min(100%, var(--content-width));
  margin-inline: auto;
  padding: 12px clamp(16px, 3vw, 34px) 4px;
}

.p2-case-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-width: 680px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

#project2 .p2-case-switch button {
  min-width: 0;
  border-color: #b8d8d2;
  background: #fff;
  color: #31535a;
  font-weight: 700;
}

#project2 .p2-case-switch button.active {
  border-color: #0f625d;
  background: #0f625d;
  color: #fff;
  box-shadow: 0 0 0 3px #c9e7e2, 0 3px 8px rgba(15, 98, 93, 0.2);
  font-weight: 800;
}

#project2 .p2-case-switch button.active::before {
  content: "✓";
  margin-right: 6px;
  font-size: 12px;
  font-weight: 800;
}

.p2-case-panel {
  display: none;
}

.p2-case-panel.active {
  display: block;
}

.p2-case-disclaimer {
  width: min(calc(100% - 32px), calc(var(--content-width) - 68px));
  margin: 0 auto 28px;
  padding: 14px 16px;
  border: 1px solid #d7e0e3;
  border-radius: 10px;
  background: #f5f7f8;
  color: var(--muted);
  font-size: 12px;
}

.bios-page {
  display: grid;
  gap: clamp(34px, 5vw, 58px);
}

.bios-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.bios-intro > div {
  max-width: 800px;
}

.bios-intro h2 {
  margin: 5px 0 8px;
  font-size: clamp(25px, 3.4vw, 38px);
}

.bios-intro p {
  margin: 0;
  color: var(--muted);
}

.bios-section {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.bios-top-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 16px;
}

.bios-case-card,
.bios-target-card {
  display: grid;
  align-content: start;
  gap: 14px;
}

.bios-case-card > label,
.bios-name-field {
  display: grid;
  gap: 5px;
  color: #3d525a;
  font-size: 12px;
  font-weight: 800;
}

.bios-case-card input,
.bios-name-field input {
  width: 100%;
  min-width: 0;
}

.bios-target-card > p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.bios-target-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.bios-target-grid label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  min-width: 0;
  color: #40545d;
  font-size: 11px;
  font-weight: 800;
}

.bios-target-grid label span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.bios-target-grid input {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
}

.bios-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.bios-config-group {
  display: grid;
  gap: 12px;
}

.bios-config-group > h3 {
  margin: 0;
  font-size: 17px;
}

.bios-config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.bios-config-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.bios-config-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #f6faf9;
}

.bios-config-card > header span {
  color: var(--muted);
  font-size: 10px;
}

.bios-config-card > header strong {
  color: #36575c;
}

.bios-name-field {
  padding: 14px 16px 0;
}

.bios-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  padding: 14px 16px 16px;
}

.bios-field {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
}

.bios-field > span {
  color: #3d525a;
  font-size: 11px;
  font-weight: 800;
}

.bios-field > span small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
}

.bios-field input,
.bios-field select {
  width: 100%;
  min-width: 0;
}

.bios-field em {
  color: var(--muted);
  font-size: 9px;
  font-style: normal;
  line-height: 1.45;
}

.bios-desktop-table table {
  min-width: 1080px;
}

.bios-desktop-table th:nth-last-child(-n + 3),
.bios-desktop-table td:nth-last-child(-n + 3) {
  min-width: 150px;
  white-space: normal;
}

.bios-mobile-cards,
.bios-time-cards {
  display: none;
}

.bios-series-card {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.bios-series-card > header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.bios-series-card header span:not(.status-tag) {
  color: var(--muted);
  font-size: 10px;
}

.bios-series-card h3 {
  margin: 2px 0 0;
  font-size: 17px;
}

.bios-series-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin: 13px 0;
  border: 1px solid #e2e9eb;
  border-radius: 8px;
  background: #e2e9eb;
}

.bios-series-card dl div {
  display: grid;
  gap: 2px;
  padding: 9px;
  background: #fff;
}

.bios-series-card dt {
  color: var(--muted);
  font-size: 9px;
}

.bios-series-card dd {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
}

.bios-series-card p,
.bios-series-card details {
  color: #4a6068;
  font-size: 11px;
}

.bios-series-card summary {
  min-height: 40px;
  padding: 8px 0;
  color: var(--accent);
  font-weight: 800;
}

.bios-chart-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.bios-chart-filters label {
  display: grid;
  gap: 4px;
  min-width: min(100%, 280px);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.bios-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.bios-chart-grid > * {
  min-width: 0;
}

.bios-risk-panel {
  grid-column: 1 / -1;
}

.bios-risk-bars {
  display: grid;
  gap: 9px;
}

.bios-risk-bars article {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 48px;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #e2e8ea;
  border-radius: 9px;
  background: #fff;
}

.bios-risk-bars article > span {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 50%;
  background: #eef3f4;
  color: #52656c;
  font-size: 11px;
  font-weight: 800;
}

.bios-risk-bars article > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.bios-risk-bars strong,
.bios-risk-bars small {
  overflow-wrap: anywhere;
}

.bios-risk-bars strong {
  font-size: 12px;
}

.bios-risk-bars i {
  display: block;
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: #edf1f2;
}

.bios-risk-bars i b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.bios-risk-bars small {
  color: var(--muted);
  font-size: 9px;
}

.bios-risk-bars article > em {
  color: #8a4d2e;
  font-size: 16px;
  font-style: normal;
  font-weight: 800;
  text-align: right;
}

.bios-chart-data {
  display: none;
}

.bios-time-cards article {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.bios-time-cards header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.bios-time-cards p {
  margin: 7px 0 0;
  color: #42575f;
  font-size: 11px;
}

.bios-time-cards small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.45;
}

.bios-summary-actions {
  align-items: center;
}

#bioStabilityCopyStatus {
  color: #38704b;
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 1100px) {
  .bios-config-grid,
  .bios-chart-grid {
    grid-template-columns: 1fr;
  }

  .bios-risk-panel {
    grid-column: auto;
  }
}

@media (max-width: 767px) {
  #project2,
  #project2 *,
  #project2 *::before,
  #project2 *::after {
    box-sizing: border-box;
  }

  .p2-case-switch-wrap {
    padding: 10px 14px 2px;
  }

  .p2-case-switch {
    width: 100%;
    max-width: 100%;
  }

  .p2-case-switch button {
    min-height: 48px;
    padding-inline: 8px;
    white-space: normal;
    font-size: 12px;
  }

  .bios-intro {
    display: grid;
    gap: 12px;
  }

  .bios-intro .data-source-tag {
    justify-self: start;
  }

  .bios-top-grid,
  .bios-config-grid,
  .bios-field-grid,
  .bios-chart-grid {
    grid-template-columns: 1fr;
  }

  .bios-target-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bios-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bios-actions button:first-child {
    grid-column: 1 / -1;
  }

  .bios-actions button {
    width: 100%;
    min-width: 0;
    white-space: normal;
  }

  .bios-config-card > header {
    align-items: start;
  }

  .bios-desktop-table {
    display: none;
  }

  .bios-mobile-cards,
  .bios-time-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .bios-chart-filters {
    display: grid;
    grid-template-columns: 1fr;
  }

  .bios-chart-filters label,
  .bios-chart-filters select {
    width: 100%;
    min-width: 0;
  }

  .bios-chart-grid .chart {
    min-height: 280px;
  }

  .bios-chart-data {
    display: grid;
    gap: 6px;
  }

  .bios-chart-data p {
    margin: 0;
    padding: 8px 10px;
    border-radius: 7px;
    background: #f5f8f8;
    color: var(--muted);
    font-size: 10px;
  }

  .bios-risk-bars article {
    grid-template-columns: 27px minmax(0, 1fr) 40px;
    padding: 9px;
  }

  .bios-summary-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bios-summary-actions button:first-child,
  #bioStabilityCopyStatus {
    grid-column: 1 / -1;
  }
}

@media (max-width: 390px) {
  .p2-case-switch {
    grid-template-columns: 1fr;
  }

  .bios-target-grid,
  .bios-actions,
  .bios-summary-actions {
    grid-template-columns: 1fr;
  }

  .bios-actions button:first-child,
  .bios-summary-actions button:first-child,
  #bioStabilityCopyStatus {
    grid-column: auto;
  }
}
