:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface-2: #eef5f2;
  --text: #14211c;
  --muted: #65756f;
  --line: #dce7e2;
  --accent: #0d7f68;
  --accent-2: #f0a43a;
  --danger: #b94b45;
  --shadow: 0 20px 70px rgba(18, 41, 34, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(13, 127, 104, 0.13), transparent 34%),
    linear-gradient(315deg, rgba(240, 164, 58, 0.18), transparent 30%),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button {
  font: inherit;
}

.shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.workspace {
  min-height: calc(100vh - 64px);
  display: grid;
  grid-template-rows: auto auto auto minmax(520px, 1fr) auto;
  gap: 14px;
}

.workspace:has(.history-panel.is-active) {
  grid-template-rows: auto auto auto auto auto;
}

.topbar,
.control-strip,
.transcript-area,
.panel {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(220, 231, 226, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.topbar {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-radius: 8px;
  padding: 22px 24px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1.08;
  font-weight: 760;
}

.topbar p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.topbar-copy {
  min-width: 0;
}

.document-switch {
  width: fit-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 16px;
  padding: 4px;
  border: 1px solid rgba(13, 127, 104, 0.18);
  border-radius: 8px;
  background: #f8fbfa;
}

.document-switch-link {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 760;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.document-switch-link:hover,
.document-switch-link:focus-visible {
  color: var(--accent);
  outline: none;
  background: rgba(13, 127, 104, 0.08);
}

.document-switch-link.is-active {
  color: #ffffff;
  background: var(--accent);
  box-shadow: 0 8px 20px rgba(13, 127, 104, 0.22);
}

.status {
  flex: 0 0 auto;
  height: 40px;
  min-width: 112px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
  background: #f8fbfa;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #93a39d;
}

.status[data-state="connecting"] .status-dot {
  background: var(--accent-2);
}

.status[data-state="active"] {
  color: #075746;
}

.status[data-state="active"] .status-dot {
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(13, 127, 104, 0.13);
}

.status[data-state="error"] {
  color: var(--danger);
}

.status[data-state="error"] .status-dot {
  background: var(--danger);
}

.control-strip {
  min-height: 76px;
  display: grid;
  grid-template-columns: auto auto auto auto auto minmax(180px, 1fr);
  align-items: center;
  gap: 12px;
  border-radius: 8px;
  padding: 14px;
}

.tabbar {
  min-height: 58px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(220, 231, 226, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.history-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: clamp(720px, 72vh, 1120px);
  min-height: 0;
  align-content: start;
  gap: 14px;
  padding: 18px 18px 16px;
  border: 1px solid rgba(220, 231, 226, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.history-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  justify-content: space-between;
  gap: 12px 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(220, 231, 226, 0.7);
}

.history-header div {
  display: grid;
  gap: 6px;
}

.history-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 6px;
}

.history-demo-button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(13, 127, 104, 0.35);
  border-radius: 8px;
  background: #0d7f68;
  color: #ffffff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 760;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(13, 127, 104, 0.18);
}

.history-demo-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.history-header h2 {
  font-size: 18px;
}

.history-header span,
.history-empty {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.history-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  align-content: start;
  gap: 12px;
  min-height: 0;
  max-height: clamp(500px, 58vh, 860px);
  overflow-y: auto;
  padding: 2px 6px 8px 2px;
  scrollbar-gutter: stable;
}

.history-section-title {
  grid-column: 1 / -1;
  margin: 4px 0 2px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 820;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 8px;
  min-height: 70px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  color: var(--text);
  text-align: left;
}

.history-item-main {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 1px 2px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.history-delete-button {
  align-self: center;
  min-width: 58px;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(185, 75, 69, 0.32);
  border-radius: 8px;
  background: #fff7f6;
  color: var(--danger);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.history-delete-button:hover,
.history-delete-button:focus-visible {
  outline: none;
  border-color: rgba(185, 75, 69, 0.7);
  background: #b94b45;
  color: #ffffff;
}

.history-item.is-active {
  border-color: rgba(13, 127, 104, 0.55);
  box-shadow: 0 0 0 3px rgba(13, 127, 104, 0.1);
}

.history-item strong,
.history-item-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
  font-size: 14px;
  font-weight: 780;
  line-height: 1.26;
}

.history-item span,
.history-item-main span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.34;
}

.tab-button {
  height: 42px;
  min-width: 150px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  font-weight: 760;
}

.tab-button.is-active {
  color: #ffffff;
  background: var(--accent);
  box-shadow: 0 10px 24px rgba(13, 127, 104, 0.2);
}

.tab-panels {
  min-height: 520px;
}

.tab-panels:has(.history-panel.is-active) {
  min-height: 0;
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: grid;
}

.record-panel.tab-panel:not(.is-active),
.transcript-area.tab-panel:not(.is-active),
.history-panel.tab-panel:not(.is-active) {
  display: none;
}

.primary-button,
.continue-button,
.secondary-button,
.ghost-button {
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 18px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 720;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.primary-button {
  color: #ffffff;
  background: var(--accent);
  box-shadow: 0 12px 28px rgba(13, 127, 104, 0.22);
}

.secondary-button {
  color: #ffffff;
  background: #243b34;
}

.continue-button {
  color: #ffffff;
  border-color: #d77c08;
  background: #d77c08;
  box-shadow: 0 12px 28px rgba(215, 124, 8, 0.28);
}

.continue-button .button-icon {
  color: #ffffff;
}

.ghost-button {
  color: var(--text);
  border-color: var(--line);
  background: #ffffff;
}

.mode-control {
  height: 48px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.mode-control select {
  min-width: 92px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.primary-button:hover,
.continue-button:hover,
.secondary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.continue-button:not(:disabled):hover {
  border-color: #bf6900;
  background: #bf6900;
  box-shadow: 0 14px 32px rgba(215, 124, 8, 0.34);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
  box-shadow: none;
}

.button-icon {
  width: 18px;
  display: inline-grid;
  place-items: center;
  font-size: 13px;
  line-height: 1;
}

.meter {
  height: 18px;
  min-width: 160px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.meter-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: inherit;
  transition: width 90ms linear;
}

.transcript-area {
  min-height: 520px;
  border-radius: 8px;
  padding: 20px;
  display: grid;
  grid-template-rows: minmax(150px, auto) 1fr;
  gap: 16px;
}

.transcript-header,
.panel h2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

h2 {
  font-size: 16px;
  line-height: 1.25;
  font-weight: 760;
}

.transcript-header span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.record-header-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.reanalyze-button,
.save-record-button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(13, 127, 104, 0.35);
  border-radius: 8px;
  background: #0d7f68;
  color: #ffffff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 820;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(13, 127, 104, 0.16);
}

.save-record-button {
  border-color: rgba(22, 88, 139, 0.28);
  background: #16588b;
  box-shadow: 0 8px 18px rgba(22, 88, 139, 0.14);
}

.reanalyze-button:hover,
.reanalyze-button:focus-visible,
.save-record-button:hover,
.save-record-button:focus-visible {
  outline: none;
  background: #096c58;
}

.save-record-button:hover,
.save-record-button:focus-visible {
  background: #104a76;
}

.reanalyze-button:disabled,
.save-record-button:disabled {
  cursor: not-allowed;
  border-color: var(--line);
  background: #eef5f2;
  color: #8a9a94;
  box-shadow: none;
}

.live-zone,
.result-zone {
  display: grid;
  gap: 12px;
}

.live-zone {
  align-content: start;
}

.live-text {
  min-height: 98px;
  display: flex;
  align-items: center;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  color: var(--accent);
  font-size: clamp(22px, 3vw, 36px);
  line-height: 1.45;
  font-weight: 760;
  overflow-wrap: anywhere;
}

.live-text:empty::before {
  content: "说话时，实时识别文本会显示在这里。";
  color: #9aa8a3;
  font-size: clamp(18px, 2.4vw, 28px);
  font-weight: 620;
}

.live-terminology-hints {
  padding: 8px 12px;
  border: 1px solid #d8e7e1;
  border-radius: 8px;
  background: #f2faf6;
  color: #2c6b52;
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.live-terminology-hints[hidden] {
  display: none;
}

.result-zone {
  min-height: 330px;
  grid-template-rows: auto 1fr;
}

.segment-list {
  min-height: 300px;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  background: #f8fbfa;
  border: 1px solid var(--line);
}

.empty-state {
  min-height: 180px;
  display: grid;
  place-items: center;
  color: #9aa8a3;
  font-size: clamp(18px, 2.2vw, 28px);
  font-weight: 560;
  text-align: center;
}

.segment-card {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.segment-card-live {
  border-color: rgba(16, 132, 103, 0.32);
  background: #f5fbf8;
}

.segment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.segment-badge {
  flex: 0 0 auto;
  min-width: 62px;
  padding: 4px 8px;
  border-radius: 6px;
  background: #eef6f2;
  color: var(--accent);
  font-size: 13px;
  font-weight: 820;
  text-align: center;
}

.segment-badge-live {
  background: rgba(13, 127, 104, 0.12);
}

.segment-time,
.segment-range {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
  text-align: right;
  overflow-wrap: anywhere;
}

.segment-body {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.segment-card p,
.segment-text {
  color: var(--text);
  font-size: 18px;
  line-height: 1.55;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.segment-raw-text {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.segment-corrections {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 6px;
  background: #f4f7fb;
  color: #356078;
  font-size: 13px;
  font-weight: 760;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.segment-audio {
  display: flex;
  align-items: center;
  gap: 10px;
}

.segment-audio::before {
  content: "原始录音";
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.segment-card-live .segment-audio::before {
  content: "实时文本";
  color: var(--accent);
}

.segment-audio:has(audio[data-tts-pending])::before {
  content: "合成语音";
}

.segment-audio:has(audio[data-audio-pending])::before {
  content: "原始录音";
}

.segment-audio[data-loading="true"]::after,
.dialog-evidence-audio[data-loading="true"]::after {
  content: attr(data-loading-label);
  color: var(--accent);
  font-size: 12px;
  font-weight: 760;
}

.segment-audio[data-loading="true"]:not([data-loading-label])::after,
.dialog-evidence-audio[data-loading="true"]:not([data-loading-label])::after {
  content: "正在加载";
}

.segment-live-hint {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.load-audio-button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid #b8d8cc;
  border-radius: 8px;
  background: #eef8f4;
  color: #08765f;
  font-size: 14px;
  font-weight: 760;
  cursor: pointer;
}

.load-audio-button:hover:not(:disabled) {
  background: #dff3ec;
  border-color: #7fc5ae;
}

.load-audio-button:disabled {
  cursor: wait;
  opacity: 0.75;
}

.segment-audio-missing {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid #dbe6e2;
  border-radius: 8px;
  background: #f6f8f7;
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
}

.segment-card audio {
  width: 100%;
  height: 36px;
}

.record-panel {
  min-height: 520px;
  grid-template-rows: auto auto 1fr;
  gap: 14px;
  padding: 20px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(220, 231, 226, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.analysis-status {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.medical-record-sheet {
  overflow-x: auto;
  display: grid;
  align-content: start;
  min-height: 760px;
  padding: 18px 44px 56px;
  border: 1px solid #d7d7d7;
  border-top: 5px solid #0d0d0d;
  border-radius: 2px;
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    #ffffff;
  color: #161616;
  font-family: "Songti SC", SimSun, "Noto Serif CJK SC", serif;
  box-shadow: 0 12px 36px rgba(20, 33, 28, 0.08);
}

.medical-record-title {
  height: 0;
  overflow: hidden;
  margin: 0;
  padding: 0;
  border: 0;
  text-align: center;
  font-size: 0;
  font-weight: 700;
}

.medical-record-meta-line {
  display: grid;
  gap: 18px;
  align-items: center;
  border-bottom: 1px solid #bcbcbc;
  line-height: 1.32;
}

.medical-record-meta-line.primary {
  grid-template-columns: minmax(310px, 0.95fr) minmax(310px, 1.05fr);
  min-height: 40px;
  font-size: 21px;
  font-weight: 700;
}

.medical-record-meta-line.patient {
  grid-template-columns: minmax(150px, 1.25fr) minmax(96px, 0.75fr) minmax(82px, 0.62fr) minmax(76px, 0.58fr) minmax(148px, 1.1fr);
  min-height: 40px;
  margin-bottom: 0;
  font-size: 17px;
}

.medical-record-meta-line label {
  display: inline-flex;
  align-items: baseline;
  min-width: 0;
  white-space: nowrap;
}

.medical-record-meta-line label span {
  flex: 0 0 auto;
}

.medical-record-meta-line input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #161616;
  font: inherit;
  line-height: 1.25;
  padding: 0;
}

.medical-record-meta-line input::placeholder,
.record-value::placeholder {
  color: #a8a8a8;
}

.medical-record-body {
  display: grid;
  border-top: 0;
}

.medical-record-row {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) 38px;
  gap: 0;
  align-items: stretch;
  min-height: 42px;
  border-bottom: 1px solid #bcbcbc;
}

.medical-record-row.compact {
  min-height: 42px;
}

.medical-record-row.tall {
  min-height: 78px;
}

.medical-record-row.prescription {
  min-height: 80px;
}

.medical-record-row.follow-up {
  min-height: 78px;
  margin-top: 32px;
}

.record-row-label {
  padding-top: 9px;
  color: #111111;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.record-value {
  width: 100%;
  min-height: 40px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: #161616;
  font: inherit;
  font-size: 18px;
  line-height: 1.38;
  padding: 8px 0 4px;
  overflow: hidden;
}

.medical-record-row.tall .record-value {
  min-height: 76px;
}

.medical-record-row.follow-up .record-value {
  min-height: 76px;
}

.ward-round-shell .tab-button {
  min-width: 180px;
}

.ward-round-sheet {
  min-height: 760px;
  padding: 34px 52px 42px;
  border: 1px solid #d7d7d7;
  border-radius: 2px;
  background: #fff;
  color: #111;
  font-family: "Songti SC", SimSun, "Noto Serif CJK SC", serif;
  box-shadow: 0 12px 36px rgba(20, 33, 28, 0.08);
}

.ward-round-title-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto minmax(160px, 1fr);
  align-items: end;
  gap: 16px;
  margin-bottom: 18px;
  text-align: center;
}

.ward-round-title-row input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #111;
  font: inherit;
  font-size: 18px;
  text-align: right;
}

.ward-round-title-row strong {
  font-size: 25px;
  font-weight: 800;
  line-height: 1.2;
}

.ward-round-meta-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) repeat(3, minmax(120px, 0.8fr));
  gap: 16px;
  min-height: 36px;
  align-items: center;
  border-bottom: 1px solid #c8c8c8;
  font-size: 16px;
}

.ward-round-meta-row label,
.ward-round-signature label {
  display: inline-flex;
  align-items: baseline;
  min-width: 0;
  white-space: nowrap;
}

.ward-round-meta-row input,
.ward-round-signature input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #111;
  font: inherit;
}

.ward-round-main-record {
  min-height: 260px;
  border-bottom: 1px solid #c8c8c8;
  padding: 14px 0 18px;
}

.ward-round-field-head,
.ward-round-entity header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #111;
  font-size: 16px;
  font-weight: 800;
}

.ward-round-narrative {
  min-height: 210px;
  padding: 8px 0 0;
  font-size: 19px;
  line-height: 1.72;
  text-indent: 2em;
}

.ward-round-entity-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid #c8c8c8;
  margin-top: 22px;
}

.ward-round-entity {
  min-height: 104px;
  border-right: 1px solid #c8c8c8;
  border-bottom: 1px solid #c8c8c8;
  padding: 10px 12px;
}

.ward-round-entity:nth-child(2n) {
  border-right: 0;
}

.ward-round-entity.span-full {
  grid-column: 1 / -1;
  border-right: 0;
}

.ward-round-entity .record-value {
  min-height: 66px;
  padding: 7px 0 0;
  font-size: 16px;
  line-height: 1.5;
}

.ward-round-signature {
  display: flex;
  justify-content: flex-end;
  margin-top: 34px;
  font-size: 18px;
}

.ward-round-signature label {
  width: 240px;
}

.surgery-record-shell .tab-button {
  min-width: 180px;
}

.surgery-record-sheet {
  min-height: 760px;
  padding: 26px 42px 42px;
  border: 1px solid #d7d7d7;
  border-radius: 2px;
  background: #fff;
  color: #111;
  font-family: "Songti SC", SimSun, "Noto Serif CJK SC", serif;
  box-shadow: 0 12px 36px rgba(20, 33, 28, 0.08);
}

.surgery-record-title-row {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) auto minmax(170px, 1fr);
  align-items: end;
  gap: 16px;
  margin-bottom: 14px;
  text-align: center;
}

.surgery-record-title-row strong {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
}

.surgery-record-title-row input,
.surgery-record-meta-row input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #111;
  font: inherit;
}

.surgery-record-title-row input {
  font-size: 16px;
  text-align: right;
}

.surgery-record-meta-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(100px, 1fr));
  gap: 12px;
  min-height: 34px;
  align-items: center;
  border-bottom: 1px solid #c8c8c8;
  font-size: 14px;
}

.surgery-record-meta-row label {
  display: inline-flex;
  align-items: baseline;
  min-width: 0;
  white-space: nowrap;
}

.surgery-record-entity-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid #c8c8c8;
  margin-top: 16px;
}

.surgery-record-entity,
.surgery-record-main-record {
  border-right: 1px solid #c8c8c8;
  border-bottom: 1px solid #c8c8c8;
  padding: 9px 12px;
}

.surgery-record-entity:nth-child(2n) {
  border-right: 0;
}

.surgery-record-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #111;
  font-size: 15px;
  font-weight: 800;
}

.surgery-record-entity .record-value {
  min-height: 56px;
  padding: 6px 0 0;
  font-size: 15px;
  line-height: 1.46;
}

.surgery-record-main-record {
  border-right: 0;
  margin-top: 16px;
  padding: 12px;
}

.surgery-record-narrative {
  min-height: 190px;
  padding: 8px 0 0;
  font-size: 16px;
  line-height: 1.68;
  text-indent: 2em;
}

.surgery-record-signers {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  margin-top: 18px;
}

.entity-detail-button {
  width: 32px;
  height: 26px;
  justify-self: end;
  align-self: start;
  margin-top: 11px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #767676;
  cursor: pointer;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.entity-detail-button:hover {
  border-color: rgba(13, 127, 104, 0.32);
  background: #f4f8f6;
  color: var(--accent);
}

.entity-hidden-fields {
  display: none;
}

.entity-dialog {
  width: min(720px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: #ffffff;
  box-shadow: 0 28px 90px rgba(18, 41, 34, 0.28);
}

.entity-dialog::backdrop {
  background: rgba(20, 33, 28, 0.36);
}

.entity-dialog-content {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.entity-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.entity-dialog-header h2 {
  font-size: 18px;
}

.dialog-close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  color: var(--text);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.entity-dialog label {
  display: grid;
  gap: 8px;
}

.entity-dialog label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.entity-dialog textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #f8fbfa;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  outline: 0;
}

.dialog-evidence-raw {
  display: none;
}

.dialog-evidence-list {
  display: grid;
  gap: 10px;
  max-height: min(42vh, 420px);
  overflow: auto;
}

.dialog-evidence-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
}

.dialog-evidence-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dialog-evidence-header span {
  min-width: 52px;
  padding: 3px 8px;
  border-radius: 6px;
  background: #eef6f2;
  color: var(--accent);
  font-size: 12px;
  font-weight: 820;
  text-align: center;
}

.dialog-evidence-header time {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.dialog-evidence-card p {
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.dialog-evidence-corrected {
  padding: 8px 10px;
  border-radius: 6px;
  background: #f4fbf8;
}

.dialog-evidence-raw-text {
  padding: 8px 10px;
  border-radius: 6px;
  background: #f7f8fa;
  color: var(--muted) !important;
}

.dialog-evidence-audio {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.dialog-evidence-audio > span:first-child {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.dialog-evidence-audio audio {
  width: 100%;
  height: 34px;
}

.dialog-evidence-missing,
.dialog-evidence-empty {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.record-value:focus,
.medical-record-meta-line input:focus {
  border-color: rgba(13, 127, 104, 0.6);
  box-shadow: inset 0 -2px 0 rgba(13, 127, 104, 0.45);
}

.details-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(320px, 1.15fr);
  gap: 18px;
}

.panel {
  border-radius: 8px;
  padding: 18px;
}

dl {
  display: grid;
  gap: 12px;
  margin: 16px 0 0;
}

dl div {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 10px;
  align-items: baseline;
}

dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

dd {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.log-panel {
  min-height: 160px;
}

.log {
  max-height: 160px;
  overflow: auto;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.log li {
  padding: 6px 0;
  border-bottom: 1px solid rgba(220, 231, 226, 0.7);
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  .shell {
    width: min(100vw - 20px, 1120px);
    padding: 10px 0;
  }

  .workspace {
    min-height: calc(100vh - 20px);
    gap: 10px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px;
  }

  .document-switch {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .document-switch-link {
    min-width: 0;
    padding: 0 8px;
    white-space: normal;
    text-align: center;
    line-height: 1.25;
  }

  .history-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .history-actions {
    width: 100%;
    justify-content: space-between;
  }

  .control-strip {
    grid-template-columns: 1fr 1fr;
  }

  .medical-record-sheet {
    min-height: 680px;
    padding: 14px 16px 28px;
  }

  .medical-record-meta-line.primary,
  .medical-record-meta-line.patient {
    grid-template-columns: 1fr;
    gap: 0;
    min-height: 0;
    padding: 8px 0;
    font-size: 17px;
  }

  .medical-record-meta-line.patient {
    font-size: 15px;
  }

  .medical-record-meta-line label {
    white-space: normal;
  }

  .medical-record-row {
    grid-template-columns: 84px minmax(0, 1fr) 34px;
    min-height: 40px;
  }

  .medical-record-row.tall,
  .medical-record-row.prescription,
  .medical-record-row.follow-up {
    min-height: 86px;
  }

  .medical-record-row.follow-up {
    margin-top: 28px;
  }

  .record-row-label {
    padding-top: 9px;
    font-size: 16px;
  }

  .record-value {
    min-height: 38px;
    font-size: 16px;
    line-height: 1.42;
    padding-top: 8px;
  }

  .medical-record-row.tall .record-value,
  .medical-record-row.follow-up .record-value {
    min-height: 84px;
  }

  .entity-detail-button {
    width: 30px;
    margin-top: 12px;
    font-size: 10px;
  }

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

  .tab-button {
    width: 100%;
  }

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

  .segment-audio {
    align-items: flex-start;
    flex-direction: column;
  }

  .ghost-button,
  .mode-control,
  .meter {
    grid-column: 1 / -1;
  }

  .details-grid {
    grid-template-columns: 1fr;
  }
}
