/* Physician reader-study platform. One sticky top bar + a single centered column; every step is one short page. */
:root {
  --bg: #f2f5f7;
  --surface: #ffffff;
  --surface-2: #e9eef2;
  --fg: #1a2530;
  --muted: #5c6c7b;
  --line: #d4dde4;
  --accent: #0e6b86;
  --accent-ink: #ffffff;
  --accent-soft: #e1eff4;
  --ok: #2c7a4b;
  --ok-soft: #e3f1e8;
  --warn: #a85a10;
  --warn-soft: #fbeedd;
  --bad: #b0302a;
  --proto: #6b4fbb;
  --proto-soft: #ede8f8;
  --hl: #a23e14;
  --hl-soft: #fce9df;
  --hl-line: #e8a383;
  --font-body:
    'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans CJK SC', 'Source Han Sans SC',
    system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-num: ui-monospace, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 40, 60, 0.06), 0 4px 14px rgba(20, 40, 60, 0.05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0f161c;
    --surface: #16202a;
    --surface-2: #1e2a35;
    --fg: #e4ebf1;
    --muted: #97a7b5;
    --line: #2b3946;
    --accent: #62b8d3;
    --accent-ink: #0a1a22;
    --accent-soft: #143440;
    --ok: #6cc08f;
    --ok-soft: #173224;
    --warn: #e3a050;
    --warn-soft: #3a2a14;
    --bad: #ea8a82;
    --proto: #b3a2ea;
    --proto-soft: #2a2444;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 14px rgba(0, 0, 0, 0.25);
    --hl: #f2a07a;
    --hl-soft: #3d2217;
    --hl-line: #7a3d22;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #0f161c;
  --surface: #16202a;
  --surface-2: #1e2a35;
  --fg: #e4ebf1;
  --muted: #97a7b5;
  --line: #2b3946;
  --accent: #62b8d3;
  --accent-ink: #0a1a22;
  --accent-soft: #143440;
  --ok: #6cc08f;
  --ok-soft: #173224;
  --warn: #e3a050;
  --warn-soft: #3a2a14;
  --bad: #ea8a82;
  --proto: #b3a2ea;
  --proto-soft: #2a2444;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 14px rgba(0, 0, 0, 0.25);
  --hl: #f2a07a;
  --hl-soft: #3d2217;
  --hl-line: #7a3d22;
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: '';
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 10;
  background: var(--surface);
}
h1,
h2,
h3 {
  margin: 0;
  line-height: 1.3;
  text-wrap: balance;
  font-weight: 650;
}
h1 {
  font-size: 21px;
}
h2 {
  font-size: 17px;
}
h3 {
  font-size: 15px;
}
p {
  margin: 0;
}
button {
  font: inherit;
  color: inherit;
}
.num {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-size: 0.94em;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12.5px;
}
[hidden] {
  display: none !important;
}

.bar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 5;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.bar-in {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding-block: 10px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.steps {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
  min-width: 0;
}
.steps li {
  font-size: 12.5px;
  padding: 3px 10px;
  border-radius: 999px;
  color: var(--muted);
}
.steps li.done {
  color: var(--ok);
}
.steps li.done::before {
  content: '✓ ';
}
.steps li.cur {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}
.step-mini {
  display: none;
  margin-left: auto;
  font-size: 12.5px;
  color: var(--muted);
}
.bar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}
.linkbtn {
  background: none;
  border: 0;
  padding: 4px 2px;
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
}
.linkbtn:hover {
  text-decoration: underline;
}

.main {
  padding-block: 22px 56px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.wrap {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.wrap.wide {
  max-width: 1000px;
}
.wrap.narrow {
  max-width: 440px;
  padding-top: 6vh;
}
.login .bd {
  gap: 16px;
}
.login .field input[type] {
  max-width: none;
  font-size: 16px;
  padding: 10px 12px;
}
.login .field input.id-input {
  font-family: var(--font-num);
  font-size: 18px;
  letter-spacing: 0.14em;
}
.login .field input.id-input::placeholder {
  font-family: var(--font-body);
  font-size: 16px;
  letter-spacing: normal;
}
.login .btn-primary {
  width: 100%;
  padding: 11px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card .hd {
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.card .bd {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.tag-proto {
  background: var(--proto-soft);
  color: var(--proto);
}
.tag-ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.tag-warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.tag-muted {
  background: var(--surface-2);
  color: var(--muted);
}
.tag-accent {
  background: var(--accent-soft);
  color: var(--accent);
}
.note {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  line-height: 1.55;
}
.note.proto {
  background: var(--proto-soft);
  color: var(--proto);
}
.note.warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.note .ic {
  flex: none;
  font-weight: 700;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
}
.btn:hover {
  background: var(--surface-2);
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover {
  background: var(--accent);
  filter: brightness(1.06);
}
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}
.btn:focus-visible,
.linkbtn:focus-visible,
input:focus-visible,
.opt:focus-within,
.chip:focus-within,
.mc:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.field .lbl {
  font-size: 13.5px;
  font-weight: 600;
}
.field input[type='text'],
.field input[type='password'] {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--fg);
  width: 100%;
  max-width: 240px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 13.5px;
  background: var(--surface);
}
.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.chip {
  position: relative;
}
.chip:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.consent input {
  margin-top: 4px;
  accent-color: var(--accent);
}
.consent:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.err {
  font-size: 13px;
  color: var(--bad);
}

.prose {
  max-width: 66ch;
}
.brief h3 {
  margin-top: 4px;
}
.brief ul {
  margin: 6px 0 0;
  padding-left: 1.2em;
}
.brief li + li {
  margin-top: 3px;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13.5px;
}
th,
td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  font-weight: 650;
  color: var(--muted);
  font-size: 12.5px;
}
tr:last-child td {
  border-bottom: 0;
}
.tbl {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.tbl.scroll {
  max-height: 380px;
  overflow: auto;
}
.tbl.scroll th {
  position: sticky;
  top: 0;
  background: var(--surface);
}

.mc {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
.mc .q {
  font-weight: 600;
  margin-bottom: 8px;
}
.mc label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.mc label:hover {
  background: var(--surface-2);
}
.mc input {
  margin-top: 5px;
  accent-color: var(--accent);
}
.mc label:has(input:checked) {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.progress-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}
.progress {
  height: 5px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.progress i {
  display: block;
  height: 100%;
  background: var(--accent);
}
.scenario {
  font-size: 12.5px;
  color: var(--muted);
}
.pt {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.pt-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}
.blk {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--surface-2);
}
.blk-l,
.sec-l {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.04em;
}
.bp {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-size: 26px;
  font-weight: 650;
  line-height: 1.3;
}
.unit {
  font-size: 13px;
  color: var(--muted);
  font-weight: 400;
  font-family: var(--font-body);
}
.basic {
  font-size: 17px;
  line-height: 1.3;
  margin-top: 6px;
}
.basic b {
  font-weight: 650;
}
.sec {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.conds {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cond {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  background: var(--surface);
}
.cond .cv {
  font-size: 12.5px;
}
.cond.on {
  background: var(--hl-soft);
  border-color: var(--hl-line);
  color: var(--hl);
  font-weight: 650;
}
.cond.on::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--hl);
}
.labs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.lab {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  min-width: 0;
}
.lab .l {
  font-size: 12.5px;
  color: var(--muted);
}
.lab .v {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-size: 19px;
  font-weight: 650;
}
.tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.calc-out {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 14px;
}
.calc-out b {
  font-size: 20px;
}
.calc-out .flag {
  flex-basis: 100%;
  font-size: 12.5px;
  color: var(--warn);
}
.prev {
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 14px;
}
.ai {
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  overflow: hidden;
}
.ai .ai-hd {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 8px 14px;
  font-weight: 650;
  font-size: 13.5px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.ai .ai-bd {
  padding: 12px 14px;
  font-size: 15px;
}
.opts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.opt {
  position: relative;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 14px 12px;
  text-align: center;
  cursor: pointer;
  font-weight: 650;
  background: var(--surface);
}
.opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.opt:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 28, 0.55);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 16px;
}
.modal {
  background: var(--surface);
  color: var(--fg);
  border-radius: 12px;
  max-width: 720px;
  width: 100%;
  max-height: 86vh;
  overflow: auto;
  border: 1px solid var(--line);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.modal .hd {
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.kpi {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
.kpi .l {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.kpi .n {
  font-family: var(--font-num);
  font-size: 19px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tabs .btn.on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
textarea.out {
  width: 100%;
  min-height: 180px;
  font-family: var(--font-num);
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-2);
  color: var(--fg);
}
.hint {
  border-left: 3px solid var(--proto);
  padding: 8px 12px;
  background: var(--proto-soft);
  color: var(--proto);
  font-size: 13px;
  border-radius: 0 8px 8px 0;
}

@media (max-width: 820px) {
  .steps {
    display: none;
  }
  .step-mini {
    display: block;
  }
}
@media (max-width: 560px) {
  .opts,
  .pt-top,
  .labs {
    grid-template-columns: 1fr;
  }
  .brand .tag {
    display: none;
  }
}

.banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 13.5px;
}
.rules {
  margin: 0;
  padding-left: 1.3em;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rules li::marker {
  font-weight: 650;
  color: var(--accent);
}
.rules .sub {
  margin: 6px 0 0;
  padding-left: 1.3em;
  columns: 3 9em;
  column-gap: 20px;
  list-style: disc;
}
.rules .sub li {
  break-inside: avoid;
  margin: 2px 0;
}
.pw-field[hidden] {
  display: none;
}
.dl {
  display: inline-flex;
  background: none;
  cursor: pointer;
  font-family: inherit;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}
.dl:hover {
  background: var(--surface-2);
}
.busy #main {
  pointer-events: none;
}
.toolbar {
  border: 1.5px solid var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toolbar-hd {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  align-items: baseline;
  color: var(--accent);
  font-size: 13.5px;
}
.toolbar-hd b {
  font-size: 15px;
}
.toolbar-btns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.tool-btn {
  padding: 11px 14px;
  font-size: 14.5px;
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface);
}
.tool-btn:hover {
  background: var(--surface);
  filter: brightness(0.97);
}
.toolbar .calc-out {
  background: var(--surface);
}
@media (max-width: 560px) {
  .toolbar-btns {
    grid-template-columns: 1fr;
  }
}
