:root {
  color-scheme: light;
  --ink: #202f28;
  --muted: #58675e;
  --green: #1c5944;
  --green-active: #124331;
  --canvas: #f5f7f2;
  --paper: #fff;
  --tint: #edf4ed;
  --line: #dbe5dc;
  --serifless: system-ui, "Microsoft YaHei", "PingFang SC", sans-serif;
  font: 16px/1.55 var(--serifless);
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; }
h1, h2, p, blockquote, ol { margin: 0; }
button, input, textarea { font: inherit; }
select { font: inherit; }
textarea { resize: vertical; line-height: 1.65; }
[hidden] { display: none !important; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #75a58d; outline-offset: 3px; }
h1:focus { outline: none; }

.masthead { position: sticky; top: 0; z-index: 3; border-bottom: 1px solid #dfe8df; background: var(--canvas); }
.masthead-inner {
  max-width: 1040px;
  min-height: 67px;
  margin-inline: auto;
  padding-inline: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; }
.brand strong { font-size: 17px; letter-spacing: .09em; }
.brand-icon { width: 33px; height: 33px; display: grid; place-items: center; background: var(--green); color: #fff; border-radius: 9px; font-size: 21px; }
.environment { color: var(--muted); font-size: 13px; }
.masthead-tools { display: flex; align-items: center; gap: 10px; }
.desk-qr { display: flex; align-items: center; gap: 5px; min-height: 44px; padding: 2px 8px 2px 3px; border: 1px solid var(--line); border-radius: 9px; color: var(--green); background: var(--paper); font-size: 12px; font-weight: 650; }
.desk-qr:hover { background: var(--tint); }
.desk-qr img { display: block; width: 37px; height: 37px; border-radius: 4px; }
@media (min-width: 1050px) {
  .desk-qr { position: fixed; top: 84px; right: 16px; flex-direction: column; padding: 7px 7px 9px; box-shadow: 0 8px 20px #3d5b4210; }
  .desk-qr img { width: 112px; height: 112px; }
}
.notice { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 4; max-width: calc(100vw - 28px); padding: 10px 15px; border-radius: 9px; background: #233c34; color: #fff; font-size: 13px; box-shadow: 0 8px 25px #233c3440; }

.workspace {
  max-width: 734px;
  margin-inline: auto;
  min-height: calc(100svh - 68px);
  padding: clamp(28px, 7vh, 77px) 22px 40px;
}
.scene {
  min-width: 0;
  padding: clamp(22px, 5vw, 41px);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 12px 36px #3d5b4210;
}
.welcome { padding-block: clamp(42px, 10vh, 87px); text-align: center; }
.contact-scene .scene-title { grid-template-columns: auto 1fr; align-items: center; justify-items: start; gap: 11px; }
.contact-scene .scene-title h1 { font-size: clamp(26px, 5vw, 34px); }
.contact-scene .medallion { width: 43px; height: 43px; border-radius: 13px; }
.contact-scene .medallion svg { width: 23px; height: 23px; }
.scene-title { display: grid; justify-items: center; gap: 17px; }
.medallion { width: 69px; height: 69px; display: grid; place-items: center; border-radius: 22px; background: var(--tint); color: var(--green); }
.medallion svg { width: 32px; height: 32px; }
h1 { font-size: clamp(29px, 6vw, 45px); line-height: 1.25; letter-spacing: -.035em; font-weight: 740; }
h2 { font-size: 15px; font-weight: 690; }
.lede { color: var(--muted); font-size: 16px; margin-top: 12px; }
.session-note { color: var(--muted); font-size: 12px; margin-top: 22px; }
.welcome-actions { display: grid; gap: 9px; justify-items: stretch; width: min(100%, 260px); margin: 26px auto 0; }
.primary, .quiet, .secondary {
  min-height: 48px;
  padding: 9px 19px;
  border: 1px solid transparent;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 660;
  font-size: 15px;
}
.primary { color: #fff; background: var(--green); }
.primary:not(:disabled):hover, .primary:not(:disabled):active { background: var(--green-active); }
.secondary { color: var(--green); background: var(--paper); border-color: var(--line); }
.quiet { color: var(--muted); background: transparent; }
.secondary:not(:disabled):hover, .quiet:not(:disabled):hover { background: var(--tint); color: var(--green); }
.welcome .primary { min-height: 54px; }

.progress { display: flex; gap: 16px; align-items: center; margin: 0 3px 15px; color: var(--muted); }
.progress ol { display: flex; flex: 1; gap: 5px; padding: 0; list-style: none; }
.progress li { height: 5px; flex: 1; border-radius: 10px; background: #dce7dd; }
.progress li.past { background: #83ad96; }
.progress li[aria-current="step"] { background: var(--green); }
.progress > span { font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 690; white-space: nowrap; }
.step-scene { min-height: 324px; text-align: center; display: flex; flex-direction: column; justify-content: flex-start; padding-top: 42px; }
.step-scene h1, .report-scene h1, .follow-up h1, .voice-scene h1 { font-size: clamp(27px, 5vw, 35px); }
.sample {
  width: min(100%, 444px);
  margin: 20px auto 0;
  padding: 15px 17px;
  border-radius: 11px;
  background: var(--tint);
  color: var(--ink);
  overflow-wrap: anywhere;
}
.sample small { color: var(--muted); display: block; margin-bottom: 3px; font-size: 13px; }
.case-context { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: min(100%, 520px); margin: 0 auto 14px; padding: 10px 13px; border-radius: 10px; background: var(--tint); }
.case-context strong, .case-context small { display: block; }
.case-context strong { font-size: 14px; }
.case-context small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.case-context .quiet { min-height: 34px; padding: 4px 8px; font-size: 12px; }
.section-hint { margin: 14px 0; }
.clip-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 9px; }
.clip-actions:empty { display: none; }
.supplement-clip { padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px; }
.clip-text { margin-top: 8px; max-height: 10rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.report-meta { margin-top: 10px; font-size: 12px; color: var(--muted); }
.stage-review { display: grid; grid-template-columns: minmax(0, 1fr) minmax(146px, .9fr); gap: 12px; align-items: center; background: var(--tint); border-radius: 12px; margin-top: 16px; padding: 12px 14px; }
.stage-review label, .stage-review > span { font-size: 16px; font-weight: 700; }
.stage-review select { width: 100%; min-height: 44px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--green); font: inherit; font-size: 14px; }
.stage-review strong { color: var(--green); text-align: right; }
.profile { margin-top: 20px; }
.profile-heading, .profile-columns { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.profile-heading { padding-bottom: 8px; }
.profile-heading h2 { font-size: 19px; }
.profile-heading span { color: var(--muted); font-size: 13px; }
.profile-columns { padding: 6px 0; color: var(--muted); border-bottom: 1px solid var(--line); font-size: 12px; }
.dimension-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; align-items: center; border-bottom: 1px solid var(--line); padding: 5px 0; min-height: 55px; }
.dimension-name { font-size: 15px; }
.dimension-grade { display: flex; align-items: center; gap: 14px; align-self: start; margin-top: 1px; }
.dimension-row:has(.grade-value) .dimension-grade { align-self: center; }
.dimension-meter { width: clamp(34px, 12vw, 102px); }
.grade-meter { display: flex; gap: 4px; }
.grade-meter i { flex: 1; height: 6px; border-radius: 8px; background: #e6edf2; }
.grade-meter .filled { background: #2676a9; }
.grade-meter .resource { background: #1a7774; }
.grade-select, .grade-value { width: 120px; border-radius: 8px; padding: 6px 9px; font-size: 13px; font-weight: 650; color: var(--green); background: var(--tint); }
.grade-select { min-height: 43px; border: 1px solid var(--line); }
.grade-value { display: inline-block; text-align: right; }
.grade-select[data-value="U"], .grade-value[data-value="U"] { color: var(--muted); background: #f7f9f7; }
.dimension-evidence summary { display: flex; flex-wrap: wrap; gap: 3px 8px; align-items: center; cursor: pointer; width: fit-content; min-height: 32px; }
.dimension-evidence summary::-webkit-details-marker { display: none; }
.dimension-evidence summary span { color: var(--green); font-size: 11px; font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }
.dimension-evidence p { margin: 3px 0 7px; padding-left: 10px; border-left: 2px solid var(--line); color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.profile-note { padding-top: 5px; font-size: 12px; }
.risk-result { display: grid; gap: 3px; margin-top: 18px; padding: 13px 15px; border-radius: 10px; color: #775122; background: #fbf1dc; }
.risk-result small { font-size: 12px; }
.risk-result strong { font-size: 19px; }
.risk-section { margin-top: 17px; }
.risk-section .record-copy { margin-top: 4px; }
.case-context strong, .live-transcript p, .record-copy { overflow-wrap: anywhere; }
.field { display: grid; gap: 6px; margin: 14px 0; font-size: 14px; font-weight: 650; }
.field input, .field textarea, .field select { width: 100%; min-height: 44px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #fcfdfb; font-weight: 400; }
.patient-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
dialog {
  width: min(460px, calc(100vw - 28px));
  max-height: calc(100dvh - 28px);
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 24px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 15px 70px #1c3c2940;
}
dialog::backdrop { background: #172d2960; }
dialog h2 { font-size: 21px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.live-transcript { margin-top: 12px; padding: 12px 14px; background: var(--tint); border-radius: 10px; }
.live-transcript small { color: var(--muted); font-size: 12px; }
.live-transcript p { margin-top: 4px; white-space: pre-wrap; min-height: 28px; }
.capture-label { display: flex; align-items: center; gap: 8px; }
.record-dot { width: 9px; height: 9px; border-radius: 50%; background: #a9b6ac; }
.record-dot.live { background: #b25048; box-shadow: 0 0 0 4px #f0d9d6; }
.capture { margin-top: 20px; padding: 13px 15px; border-radius: 12px; background: var(--canvas); }
.capture-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 680; }
.capture-head time { color: var(--green); font-size: 20px; font-variant-numeric: tabular-nums; }
.risk-form { margin-top: 12px; }
.choices { display: grid; gap: 8px; padding: 0; border: 0; }
.choices label { display: flex; align-items: center; gap: 8px; min-height: 43px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.choices input { width: 18px; height: 18px; accent-color: var(--green); }
.hold { margin-top: 12px; padding: 10px 12px; border-radius: 8px; color: #775122; background: #fbf1dc; font-size: 13px; }
.report-options { margin-top: 15px; border-top: 1px solid var(--line); }
.report-options summary { padding: 11px 0; color: var(--green); cursor: pointer; }
.record-copy { margin: 0 0 12px; white-space: pre-wrap; color: var(--muted); font-size: 13px; }
.record-copy strong { color: var(--ink); }
.action-bar {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 9px;
  padding: 12px 0;
}
.action-bar .primary { min-height: 51px; }
.action-bar { align-items: center; }

.report-scene .scene-title, .follow-up .scene-title, .voice-scene .scene-title {
  grid-template-columns: auto 1fr;
  align-items: center;
  justify-items: start;
  gap: 11px;
}
.report-scene .medallion, .follow-up .medallion, .voice-scene .medallion {
  width: 43px; height: 43px; border-radius: 13px;
}
.report-scene .medallion svg, .follow-up .medallion svg, .voice-scene .medallion svg { width: 22px; height: 22px; }
.report-highlight { margin-top: 16px; border-radius: 12px; background: var(--tint); display: grid; grid-template-columns: 1fr 1fr; }
.report-highlight div { min-width: 0; padding: 12px 15px; overflow-wrap: anywhere; }
.report-highlight div + div { border-left: 1px solid var(--line); }
.report-highlight small, .report-highlight strong { display: block; }
.report-highlight small { color: var(--muted); font-size: 12px; margin-bottom: 3px; }
.report-highlight strong { font-size: 16px; }
.chip { background: var(--tint); color: var(--green); border-radius: 5px; padding: 1px 6px; font-size: 12px; white-space: nowrap; }

.capture { margin-top: 20px; border-radius: 12px; padding: 13px 15px; background: var(--canvas); }
.capture-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-weight: 670; }
.capture-head time { color: var(--green); font-variant-numeric: tabular-nums; font-size: 19px; }
.hint { color: var(--muted); font-size: 14px; margin-top: 4px; }
.voice-text { width: 100%; white-space: pre-wrap; margin-top: 9px; }
.voice-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 7px; margin-top: 17px; }
.voice-actions .quiet { margin-right: auto; }
audio[controls] { display: block; width: 100%; margin-top: 10px; }

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 620px) {
  .masthead-inner { min-height: 56px; padding-inline: 16px; }
  .workspace { min-height: calc(100svh - 57px); padding: 25px 14px 22px; }
  .scene { border-radius: 17px; }
  .step-scene { min-height: 302px; padding-top: 36px; }
  .action-bar { position: sticky; bottom: 0; background: var(--canvas); }
  .voice-actions .primary, .voice-actions .secondary { flex-grow: 1; }
  .dimension-meter { display: none; }
  .patient-fields { gap: 7px; }
  .dialog-actions { flex-wrap: wrap; }
  .dialog-actions > * { flex: 1; }
}

.waiting-scene { max-width: 530px; margin-inline: auto; text-align: center; }
.waiting-scene .lede { max-width: 35ch; margin-inline: auto; }
.waiting-scene .primary { margin-top: 16px; }
.eyebrow { color: var(--green); font-size: 13px; font-weight: 650; margin-bottom: 7px; }
.intake-qr { display: block; width: 182px; height: 182px; margin: 22px auto 8px; border: 1px solid var(--line); border-radius: 12px; }
.patient-link { display: block; width: fit-content; margin: 13px auto; color: var(--green); font-size: 14px; text-underline-offset: 3px; }
.desk-ready { color: var(--green); font-size: 14px; font-weight: 650; margin-top: 14px; }
.desk-tools, .result-actions, .history-list { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.desk-tools { justify-content: center; margin-top: 8px; }
.encounter-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(0, 1.4fr) repeat(2, minmax(0, 1fr)); gap: 5px; margin-bottom: 15px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); }
.phase-link { min-height: 43px; padding: 5px 4px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: clamp(12px, 3vw, 15px); font-weight: 650; }
.phase-link[aria-current="step"] { background: var(--green); color: #fff; }
.phase-link:not([aria-current]):hover { background: var(--tint); }
.encounter-scene h1 { font-size: clamp(27px, 5vw, 36px); }
.encounter-action { position: sticky; bottom: 0; display: grid; gap: 4px; padding: 10px 0; background: var(--canvas); }
.encounter-action .primary { min-height: 54px; }
.draft-sheet { margin: 18px 0 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--tint); padding: 14px 15px; }
.draft-sheet .record-copy { margin: 0; color: var(--ink); font-size: 15px; }
.demo-label { display: inline-block; color: #775122; background: #fbf1dc; padding: 4px 8px; border-radius: 5px; font-size: 12px; margin-top: 10px; }
.risk-review { margin-top: 14px; border: 1px solid #eddcb8; background: #fffcf6; border-radius: 12px; padding: 12px; }
.risk-review .record-copy { margin-top: 6px; }
.result-actions { margin-top: 20px; }
.next-patient { display: flex; width: 100%; min-height: 56px; margin-top: 21px; font-size: 17px; }
.patient-workspace { max-width: 515px; }
.consent { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; margin: 7px 0 20px; }
.consent input { width: 18px; height: 18px; flex: 0 0 18px; accent-color: var(--green); }
.check-in-submit { width: 100%; }
.registration-dialog { width: min(670px, calc(100vw - 28px)); padding: clamp(16px, 4vw, 26px); }
.registration-dialog[data-mode="qr"] { width: min(350px, calc(100vw - 28px)); }
.registration-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.registration-heading h2 { font-size: 22px; }
.registration-heading .quiet { min-height: 44px; padding-inline: 10px; }
.registration-body { display: grid; grid-template-columns: minmax(0, 1fr) 184px; align-items: start; gap: 24px; }
.registration-dialog[data-mode="qr"] .registration-body { grid-template-columns: minmax(0, 1fr); }
.registration-qr { padding: 12px 9px 9px; border: 1px solid var(--line); border-radius: 12px; background: var(--canvas); text-align: center; }
.registration-qr h3 { margin: 0; font-size: 15px; }
.registration-qr img { display: block; width: min(100%, 182px); height: auto; margin: 7px auto 0; border-radius: 7px; }
.registration-qr .patient-link { margin: 7px auto 3px; }
#manual-check-in-error { margin: 0 0 10px; }
@media (max-width: 560px) {
  .registration-body { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .registration-dialog[data-mode="manual"] .registration-qr img { width: min(100%, 150px); }
}

.capture.capture-live {
  border: 1px solid #ccded2;
  background:
    radial-gradient(circle, #3b746326 1px, transparent 1.5px) 0 0 / 11px 11px,
    linear-gradient(112deg, #f0f7f1, #e6f2eb);
}
.capture-live .record-dot { animation: record-pulse 1.7s ease-out infinite; }
@keyframes record-pulse {
  0% { box-shadow: 0 0 0 0 #b2504860; }
  75%, 100% { box-shadow: 0 0 0 7px #b2504800; }
}
.record-meter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 42px;
  transform: scaleY(var(--level, .24));
  transition: transform 110ms ease-out;
}
.record-meter i {
  width: 4px;
  height: 44%;
  border-radius: 4px;
  background: #36765e;
}
.record-meter i:nth-child(2n) { height: 64%; }
.record-meter i:nth-child(3n) { height: 83%; }
.record-meter i:nth-child(5) { height: 100%; }
.record-meter i:first-child, .record-meter i:last-child { height: 30%; }
.live-transcript {
  margin-top: 14px;
  border: 1px solid var(--line);
  background: #f6f9f6;
}
.live-transcript summary { font-weight: 650; }
.live-transcript .record-copy {
  max-height: 14rem;
  overflow-y: auto;
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
}
.asr-progress {
  margin-top: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--tint);
  color: var(--green);
  font-size: 14px;
}
@media (prefers-reduced-motion: reduce) {
  .capture-live .record-dot { animation: none; }
  .record-meter { transition: none; }
}
