:root {
  color-scheme: light;
  --ink: #24292f;
  --muted: #687078;
  --line: #d9dee2;
  --paper: #ffffff;
  --canvas: #f3f5f5;
  --teal: #147c82;
  --teal-dark: #0b5f64;
  --teal-soft: #eaf5f4;
  --burgundy: #803044;
  --red-soft: #fbebee;
  --warning: #8a5b00;
  --warning-soft: #fff3d6;
  font-family: "Microsoft YaHei UI", "Noto Sans CJK SC", Arial, sans-serif;
  font-size: 16px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); }
a { color: var(--teal-dark); }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: 30px; line-height: 1.25; letter-spacing: 0; }
h2 { margin-bottom: 18px; font-size: 20px; letter-spacing: 0; }
h3 { margin-bottom: 7px; font-size: 16px; line-height: 1.45; letter-spacing: 0; }
.topbar { height: 58px; padding: 0 max(24px, calc((100vw - 1240px) / 2)); display: flex; align-items: center; justify-content: space-between; background: #20272b; color: white; }
.brand { color: white; text-decoration: none; font-weight: 700; }
.topnav { display: flex; align-items: center; gap: 14px; }
.topnav form { margin: 0; }
.user { color: #cfd6d8; font-size: 13px; }
.page { max-width: 1240px; margin: 0 auto; padding: 30px 24px 64px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.run-heading { align-items: center; }
.eyebrow { margin-bottom: 5px; color: var(--teal-dark); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.muted, .form-note { color: var(--muted); }
.form-note { margin: -2px 0 2px; font-size: 12px; line-height: 1.55; }
.dashboard-grid { display: grid; grid-template-columns: minmax(360px, 0.85fr) minmax(420px, 1.15fr); gap: 22px; margin-bottom: 30px; }
.tool-panel, .activity-panel, .login-panel { padding: 24px; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; }
.activity-panel { min-height: 370px; }
.stack-form { display: grid; gap: 16px; }
label { display: grid; gap: 7px; color: #4d555b; font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; min-height: 42px; border: 1px solid #bfc7cc; border-radius: 4px; background: white; padding: 9px 11px; color: var(--ink); font: inherit; font-size: 14px; }
textarea { resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { outline: 2px solid #8cc7c9; outline-offset: 1px; border-color: var(--teal); }
input[type="radio"] { width: 17px; min-height: 17px; accent-color: var(--teal); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.button { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; padding: 8px 14px; border: 1px solid #b9c2c7; border-radius: 4px; background: white; color: #283035; font: inherit; font-size: 13px; font-weight: 700; text-decoration: none; cursor: pointer; }
.button:hover { border-color: #7c898f; }
.button.primary { border-color: var(--teal); background: var(--teal); color: white; }
.button.primary:hover { background: var(--teal-dark); }
.button.ghost { min-height: 32px; border-color: #69747a; background: transparent; color: white; }
.button.compact { min-height: 32px; padding: 5px 10px; }
.button.full { width: 100%; }
.service-state, .status { display: inline-flex; align-items: center; min-height: 28px; padding: 4px 9px; border-radius: 4px; white-space: nowrap; font-size: 12px; font-weight: 700; }
.service-state.ready, .status.completed { background: var(--teal-soft); color: var(--teal-dark); }
.service-state.warning { background: var(--warning-soft); color: var(--warning); }
.status.running { background: #e8f0f3; color: #315d6c; }
.status.queued, .status.neutral { background: #edf0f2; color: #566168; }
.status.failed { background: var(--red-soft); color: var(--burgundy); }
.status.large { min-height: 34px; font-size: 13px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.section-title h2 { margin: 0; }
.section-title span { color: var(--muted); font-size: 12px; }
.job-row { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; padding: 14px 0; border-top: 1px solid #e7eaec; }
.job-row:first-child { border-top: 0; }
.job-main { display: grid; gap: 4px; }
.job-main strong { font-size: 14px; }
.job-main span, .job-row a { font-size: 12px; }
.job-row progress { grid-column: 1 / -1; width: 100%; height: 6px; accent-color: var(--teal); }
.job-error { grid-column: 1 / -1; margin: 0; color: var(--burgundy); font-size: 12px; }
.runs-section, .preview-section { padding-top: 2px; }
.table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; background: white; }
th, td { padding: 13px 14px; border-bottom: 1px solid #e5e9eb; text-align: left; font-size: 13px; vertical-align: middle; }
th { background: #f8f9f9; color: var(--muted); font-size: 11px; text-transform: uppercase; }
td small { display: block; margin-top: 4px; color: var(--muted); }
.empty { padding: 32px 0; color: var(--muted); text-align: center; }
.notice { margin-bottom: 18px; padding: 12px 14px; border-left: 4px solid var(--teal); background: var(--teal-soft); color: var(--teal-dark); font-size: 14px; }
.notice.danger { border-color: var(--burgundy); background: var(--red-soft); color: var(--burgundy); }
.login-shell { min-height: calc(100vh - 150px); display: grid; place-items: center; }
.login-panel { width: min(400px, 100%); }
.back-link { display: inline-block; margin-bottom: 18px; font-size: 13px; }
.output-strip { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 24px; padding: 12px 14px; background: white; border: 1px solid var(--line); }
.output-strip strong { margin-right: 6px; font-size: 13px; }
.workflow-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin-bottom: 30px; border-block: 1px solid var(--line); }
.workflow-actions > div { position: relative; padding: 18px 22px 15px 54px; border-left: 1px solid var(--line); }
.workflow-actions > div:first-child { border-left: 0; }
.workflow-actions p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.step-no { position: absolute; left: 17px; top: 18px; width: 25px; height: 25px; display: grid; place-items: center; background: #273238; color: white; border-radius: 50%; font-size: 12px; font-weight: 700; }
.evidence-list { display: grid; gap: 12px; }
.evidence-card { padding: 18px 20px; background: white; border: 1px solid var(--line); border-left: 4px solid var(--teal); border-radius: 4px; }
.evidence-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding-bottom: 12px; border-bottom: 1px solid #e8ebed; }
.evidence-head p { margin: 0; color: var(--muted); font-size: 12px; }
.pmid { display: block; margin-bottom: 5px; color: var(--teal-dark); font-size: 11px; font-weight: 700; }
.evidence-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 28px; padding: 16px 0; }
.evidence-grid .wide { grid-column: 1 / -1; }
.evidence-grid span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; font-weight: 700; }
.evidence-grid p { margin: 0; font-size: 13px; line-height: 1.55; }
.evidence-grid .claim { padding: 10px 12px; background: var(--teal-soft); }
.evidence-actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid #e8ebed; }
.evidence-actions label { display: flex; align-items: center; gap: 6px; }
.approval-bar { display: flex; align-items: end; gap: 14px; margin-top: 16px; padding: 16px; background: #e9edef; border-top: 1px solid #cfd6da; }
.approval-bar label { min-width: 240px; }
.approval-bar .grow { flex: 1; }
.generation-band { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 30px 0; padding: 22px 24px; background: #273238; color: white; }
.generation-band h2 { margin-bottom: 5px; }
.generation-band p { margin: 0; color: #d6dde0; font-size: 13px; }
.preview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.preview-grid a { display: block; background: white; border: 1px solid var(--line); }
.preview-grid img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: contain; }
.qa-action { margin-top: 12px; text-align: right; }
.edit-form { padding-bottom: 72px; }
.edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.edit-grid label { padding: 14px; background: white; border: 1px solid var(--line); }
.edit-grid .wide { grid-column: 1 / -1; }
.approval-bar.sticky { position: sticky; bottom: 0; z-index: 4; box-shadow: 0 -5px 16px rgb(35 44 49 / 10%); }
@media (max-width: 840px) {
  .page { padding-inline: 14px; }
  .dashboard-grid, .workflow-actions, .edit-grid { grid-template-columns: 1fr; }
  .workflow-actions > div { border-left: 0; border-top: 1px solid var(--line); }
  .workflow-actions > div:first-child { border-top: 0; }
  .page-heading, .generation-band, .approval-bar { align-items: stretch; flex-direction: column; }
  .form-row, .evidence-grid, .preview-grid { grid-template-columns: 1fr; }
  .evidence-grid .wide { grid-column: auto; }
  .evidence-head { gap: 10px; }
  .approval-bar label { min-width: 0; }
  h1 { font-size: 25px; }
}
