/* ============================================================
   医生端：工作台 / 病历阅读 / 判读 / 录音
   ============================================================ */

.workbench { padding: 26px 0 64px; }
.work-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 18px; flex-wrap: wrap;
}
.work-head h1 { font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.work-head p { margin-top: 4px; font-size: 13px; color: var(--muted); }
.work-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.work-summary {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 18px 20px; align-items: center;
}
.summary-label { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.summary-label span { font-size: 12px; color: var(--muted); }
.summary-label b { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.summary-label b small { font-size: 12px; color: var(--faint); font-weight: 400; }
.bar { height: 6px; border-radius: 3px; background: #edf0ef; overflow: hidden; margin: 9px 0 7px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.summary-sub { font-size: 12px; color: var(--faint); }
.summary-stats { display: flex; align-items: center; gap: 26px; }
.summary-stat { min-width: 62px; }
.summary-stat b { display: block; font-size: 19px; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.summary-stat span { display: block; font-size: 11.5px; color: var(--faint); margin-top: 2px; }

.campaign-block { margin-top: 26px; }
.campaign-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.campaign-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.campaign-meta { font-size: 12px; color: var(--faint); margin-top: 3px; }
.case-list {
  display: flex; flex-direction: column; border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; background: #fff;
}
.case-row {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) 96px 86px 56px 24px;
  align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line);
  background: #fff; text-align: left; transition: background .12s;
}
.case-row:last-child { border-bottom: 0; }
.case-row:hover { background: #fafbfa; text-decoration: none; }
.case-seq { font-family: var(--font-mono); font-size: 11.5px; color: var(--faint); }
.case-code { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.case-sub { font-size: 11px; color: var(--faint); margin-top: 1px; }
.case-arrow { color: var(--faint); display: grid; place-items: center; }
.case-arrow svg { width: 16px; height: 16px; }
.case-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.instructions {
  margin-top: 24px; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; overflow: hidden;
}
.instructions summary {
  list-style: none; cursor: pointer; padding: 13px 16px; font-weight: 500; font-size: 13px;
  display: flex; align-items: center; gap: 8px; color: var(--ink-2);
}
.instructions summary::-webkit-details-marker { display: none; }
.instructions summary svg { width: 15px; height: 15px; color: var(--muted); }
.instructions .body { padding: 0 16px 16px; color: var(--muted); font-size: 12.5px; line-height: 1.85; white-space: pre-wrap; }

/* ---------------------------------------------------------------- case page */
.case-page { padding: 18px 0 84px; }
.case-topline { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.case-topline .back { color: var(--muted); }
.case-topline .code { font-size: 17px; font-weight: 600; }
.case-topline .chip-time {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted);
  background: #fff; border: 1px solid var(--line); padding: 4px 8px; border-radius: 5px;
  font-variant-numeric: tabular-nums;
}
.case-topline .chip-time svg { width: 12px; height: 12px; }
.case-layout { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 20px; align-items: start; }
.reader { min-width: 0; }

.record-paper {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 32px 38px 28px;
}
.record-head { padding-bottom: 16px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.record-head .rh-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 9px; }
.record-title { font-size: 21px; font-weight: 600; letter-spacing: .01em; color: var(--ink); line-height: 1.35; }
.record-sub { font-size: 11.5px; color: var(--faint); margin-top: 5px; line-height: 1.6; }
.record-section { padding: 16px 0 4px; }
.record-section + .record-section { border-top: 1px solid #f0f2f1; }
.record-section h3 {
  display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600;
  color: var(--accent-2); margin-bottom: 7px;
}
.record-section h3::before { content: ""; width: 3px; height: 12px; border-radius: 1px; background: var(--accent); flex: none; }
.record-section p {
  font-size: 15px; line-height: 1.92; color: #2b3440; text-align: justify;
  letter-spacing: .005em; margin-bottom: 7px;
}
.record-section p:last-child { margin-bottom: 0; }
.record-note {
  margin-top: 14px; padding: 10px 12px; border-radius: 6px; background: #f7f8f7;
  color: #8a929c; font-size: 11.5px; line-height: 1.75; border: 1px solid var(--line);
}
.record-narrative { padding-top: 16px; }
.record-narrative p { font-size: 15px; line-height: 1.95; color: #2b3440; text-align: justify; margin-bottom: 10px; }

/* AI block */
.ai-block { margin-top: 16px; border: 1px solid #dbe3e0; border-radius: var(--radius-lg); background: #fff; }
.ai-inner { padding: 18px 20px 20px; }
.ai-head { display: flex; align-items: flex-start; gap: 10px; }
.ai-head .spark {
  width: 30px; height: 30px; border-radius: 7px; flex: none; display: grid; place-items: center;
  background: #f1f5f4; color: var(--accent); border: 1px solid #e0e7e4;
}
.ai-head .spark svg { width: 16px; height: 16px; }
.ai-head h3 { font-size: 14px; font-weight: 600; }
.ai-head .ai-tag { font-size: 10.5px; color: var(--faint); letter-spacing: .04em; margin-top: 1px; }
.ai-head .badge { margin-left: auto; }
.ai-opinion {
  margin-top: 13px; padding: 11px 13px; border-radius: 7px;
  background: #f7f8f7; border: 1px solid var(--line);
  font-size: 13px; line-height: 1.75; color: var(--ink-2);
}
.ai-opinion b { color: var(--accent-2); font-weight: 600; }
.ai-basis { margin-top: 8px; font-size: 12.5px; line-height: 1.8; color: var(--muted); }
.ai-basis .k { font-weight: 600; color: var(--ink-2); }
.ai-predict {
  display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: start;
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line);
}
.ai-predict .p-label { font-size: 11px; color: var(--faint); margin-bottom: 2px; }
.ai-predict .p-val { font-size: 26px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.ai-predict .p-val.risk { color: var(--red); }
.ai-predict .p-val.safe { color: var(--accent); }
.ai-predict .p-verdict { font-size: 12.5px; margin-top: 5px; }
.ai-predict .p-verdict.risk { color: var(--red); }
.ai-predict .p-verdict.safe { color: var(--accent-2); }
.p-track { position: relative; height: 6px; border-radius: 3px; background: #edf0ef; margin-top: 10px; }
.p-track .p-thr { position: absolute; top: -3px; width: 1px; height: 12px; background: #b8bfc4; }
.p-track .p-mark {
  position: absolute; top: 50%; width: 12px; height: 12px; border-radius: 50%;
  transform: translate(-50%, -50%); background: #fff; border: 2px solid var(--accent);
}
.p-scale { display: flex; justify-content: space-between; font-size: 9.5px; color: var(--faint); margin-top: 4px; }
.ai-shap { margin-top: 15px; }
.ai-shap .shap-title { font-size: 11.5px; color: var(--muted); line-height: 1.7; margin-bottom: 8px; }
.ai-risk {
  margin-top: 14px; padding: 15px 16px; border-radius: 8px; border: 1px solid var(--line);
  background: #f7f8f7;
}
.ai-risk.high { border-color: #e8b4ae; background: #fdf6f5; }
.ai-risk.low { border-color: #b9dcc4; background: #f2f9f4; }
.ai-risk-label { font-size: 11px; color: var(--muted); letter-spacing: .06em; }
.ai-risk-value { font-size: 23px; font-weight: 600; margin-top: 5px; color: var(--ink); }
.ai-risk.high .ai-risk-value { color: var(--red); }
.ai-risk.low .ai-risk-value { color: var(--accent); }
.ai-risk-note { margin-top: 5px; font-size: 11.5px; color: var(--faint); line-height: 1.6; }
.shap-frame {
  position: relative; border-radius: 7px; overflow: hidden; border: 1px solid var(--line);
  background: #fff; cursor: zoom-in;
}
.shap-frame img { width: 100%; height: auto; display: block; }
.shap-frame .zoom-hint {
  position: absolute; right: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 4px;
  background: rgba(17, 24, 39, .72); color: #fff; font-size: 10.5px; padding: 4px 8px; border-radius: 4px;
  opacity: 0; transition: opacity .15s;
}
.shap-frame:hover .zoom-hint { opacity: 1; }
.shap-frame .zoom-hint svg { width: 11px; height: 11px; }

/* judgment rail */
.judge-rail { position: sticky; top: calc(var(--topbar-h) + 14px); }
.judge-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  display: flex; flex-direction: column; max-height: calc(100dvh - var(--topbar-h) - 28px);
  overflow: hidden;
}
.judge-head { padding: 14px 16px 12px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.judge-head .jh-title { font-size: 14px; font-weight: 600; }
.judge-head .jh-sub { font-size: 11.5px; color: var(--faint); margin-top: 1px; }
.judge-head .jh-step {
  margin-left: auto; font-size: 11px; font-weight: 500; color: var(--accent-2);
  background: var(--accent-soft); border-radius: 4px; padding: 3px 7px; font-variant-numeric: tabular-nums;
}
.judge-body { padding: 16px; overflow: auto; display: flex; flex-direction: column; gap: 18px; }
.judge-foot { padding: 12px 16px 14px; border-top: 1px solid var(--line); background: #fff; display: flex; flex-direction: column; gap: 8px; }
.judge-close { display: none; margin-left: auto; border: 1px solid var(--line); background: #fff; width: 30px; height: 30px; border-radius: 6px; }
.q-label { display: flex; align-items: baseline; gap: 7px; margin-bottom: 8px; }
.q-label .n {
  width: 16px; height: 16px; border-radius: 4px; background: #eef1f0; color: var(--muted);
  font-size: 10px; font-weight: 600; display: grid; place-items: center; flex: none;
}
.q-label .t { font-size: 13px; font-weight: 600; }
.q-label .req { color: var(--red); font-size: 11px; }
.q-label .opt { color: var(--faint); font-size: 11px; margin-left: auto; }
.q-hint { font-size: 11px; color: var(--faint); line-height: 1.6; margin-top: 6px; }

.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice {
  position: relative; display: flex; flex-direction: column; gap: 3px; padding: 10px 10px 9px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: #fff;
  text-align: left; transition: border-color .12s, background .12s; min-height: 74px;
}
.choice:hover { border-color: #aab4b0; }
.choice .ct { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.choice .ct svg { width: 15px; height: 15px; }
.choice .cd { font-size: 10.5px; color: var(--muted); line-height: 1.45; }
.choice .tick {
  position: absolute; top: 8px; right: 8px; width: 15px; height: 15px; border-radius: 50%;
  border: 1px solid var(--line-strong); display: grid; place-items: center; opacity: 0;
  background: #fff; color: #fff;
}
.choice .tick svg { width: 9px; height: 9px; }
.choice.selected { border-color: var(--accent); background: var(--accent-soft); }
.choice.selected .tick { opacity: 1; background: var(--accent); border-color: var(--accent); }
.choice-pos { color: #9f2d24; }
.choice-pos.selected { border-color: #c96a63; background: #fdf6f5; }
.choice-pos.selected .tick { background: #b42318; border-color: #b42318; }
.choice-neg { color: var(--accent-2); }
.choice-neg.selected { border-color: var(--accent); background: var(--accent-soft); }
.choice-hys-yes { color: #8a5a12; }
.choice-hys-yes.selected { border-color: #c99a4e; background: #fffbf2; }
.choice-hys-yes.selected .tick { background: #b45309; border-color: #b45309; }
.choice-hys-no { color: #4b5c70; }
.choice-hys-no.selected { border-color: #94a3b8; background: #f8fafc; }
.choice-hys-no.selected .tick { background: #475569; border-color: #475569; }

.certainty-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.certainty-row button {
  height: 34px; border-radius: 7px; border: 1px solid var(--line-strong); background: #fff;
  font-size: 10.5px; font-weight: 500; color: var(--muted); transition: border-color .12s, background .12s, color .12s;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  padding: 0 2px; white-space: nowrap;
}
.certainty-row button .lv { font-size: 9px; color: var(--faint); }
.certainty-row button:hover { border-color: #aab4b0; }
.certainty-row button.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-2); }
.certainty-row button.active .lv { color: var(--accent); }

.rationale-wrap { position: relative; }
.rationale-wrap .textarea { min-height: 110px; padding-bottom: 28px; font-size: 13.5px; }
.char-count { position: absolute; right: 10px; bottom: 7px; font-size: 10.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.char-count.ok { color: var(--accent); }

.auto-state { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--faint); }
.auto-state .dot { background: var(--faint); }
.auto-state.saving .dot { background: var(--amber); }
.auto-state.saved .dot { background: var(--green); }
.auto-state.error .dot { background: var(--red); }

/* recorder */
.rec-card { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #fafbfa; }
.rec-top { display: flex; align-items: center; gap: 10px; }
.rec-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; flex: none;
  background: var(--accent); color: #fff; display: grid; place-items: center;
  transition: background .15s;
}
.rec-btn:hover { background: var(--accent-2); }
.rec-btn svg { width: 19px; height: 19px; }
.rec-btn.recording { background: var(--red); }
.rec-info { min-width: 0; flex: 1; }
.rec-info .rt { font-size: 12.5px; font-weight: 500; }
.rec-info .rs { font-size: 10.5px; color: var(--faint); margin-top: 2px; }
.rec-timer { font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.rec-wave { height: 38px; margin-top: 9px; width: 100%; display: block; }
.rec-actions { display: flex; gap: 8px; margin-top: 9px; }
.rec-card.file-only .rec-actions { margin-top: 6px; }
.rec-card.file-only .rec-actions .btn-primary { width: 100%; justify-content: center; }
.rec-card.file-only .rec-top { gap: 0; }
.rec-error { margin-top: 8px; font-size: 11px; color: var(--red); line-height: 1.5; }
.audio-list { display: flex; flex-direction: column; gap: 7px; margin-top: 9px; }
.audio-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 6px;
  background: #fff; border: 1px solid var(--line);
}
.audio-item .ai { width: 26px; height: 26px; border-radius: 5px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.audio-item .ai svg { width: 14px; height: 14px; }
.audio-item audio { height: 30px; flex: 1; min-width: 0; }
.audio-item .del { border: 0; background: none; color: var(--faint); padding: 4px; border-radius: 4px; }
.audio-item .del:hover { color: var(--red); background: var(--red-soft); }

.submit-note { font-size: 10.5px; color: var(--faint); line-height: 1.5; text-align: center; }
.judge-foot .btn-primary { height: 42px; font-size: 14px; }

/* mobile action bar + sheet */
.mobile-actionbar {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
  padding: 9px 14px calc(9px + env(safe-area-inset-bottom));
  background: #fff; border-top: 1px solid var(--line); gap: 10px; align-items: center;
}
.mobile-actionbar .mab-info { font-size: 11px; color: var(--muted); line-height: 1.35; }
.mobile-actionbar .mab-info b { display: block; font-size: 12.5px; color: var(--ink); }
.sheet-backdrop { display: none; position: fixed; inset: 0; z-index: 85; background: rgba(15, 23, 42, .35); opacity: 0; transition: opacity .2s; }
.sheet-backdrop.show { display: block; opacity: 1; }

/* zoom modal */
.shap-modal .modal { width: min(1160px, 96vw); }
.shap-modal .modal-body { padding: 10px; background: #f4f5f4; }
.shap-modal img { width: 100%; height: auto; border-radius: 6px; background: #fff; }

/* done page */
.done-wrap { min-height: calc(100dvh - var(--topbar-h)); display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.done-card {
  width: min(480px, 100%); text-align: center; padding: 36px 30px; border-radius: var(--radius-lg);
  background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow);
}
.done-check {
  width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; border: 1px solid #d5e9e5;
}
.done-check svg { width: 26px; height: 26px; }
.done-card h1 { font-size: 20px; margin-bottom: 6px; font-weight: 600; }
.done-card p { color: var(--muted); font-size: 12.5px; line-height: 1.8; }
.done-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 22px 0 20px; }
.done-stat { padding: 10px 6px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--line); }
.done-stat .v { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.done-stat .k { font-size: 10px; color: var(--faint); margin-top: 2px; }
.done-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* responsive */
@media (max-width: 1180px) {
  .case-layout { grid-template-columns: minmax(0, 1fr) 348px; gap: 16px; }
  .record-paper { padding: 28px 30px 24px; }
}
@media (max-width: 1020px) {
  .work-summary { grid-template-columns: 1fr; gap: 14px; }
  .summary-stats { justify-content: space-between; gap: 12px; }
  .case-layout { grid-template-columns: 1fr; }
  .judge-rail { position: fixed; inset: 0; z-index: 90; display: block; visibility: hidden; }
  .judge-rail .judge-card {
    position: absolute; left: 0; right: 0; bottom: 0; max-height: 93dvh;
    border-radius: 12px 12px 0 0; transform: translateY(102%); transition: transform .25s var(--ease);
    border-bottom: 0;
  }
  .judge-rail.open { visibility: visible; background: rgba(15, 23, 42, .28); }
  .judge-rail.open .judge-card { transform: translateY(0); }
  .judge-close { display: grid; place-items: center; }
  .judge-head { position: sticky; top: 0; background: #fff; z-index: 2; }
  .judge-body { padding-bottom: 20px; }
  .judge-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .mobile-actionbar { display: flex; }
  .case-page { padding-bottom: 104px; }
  .shap-frame .zoom-hint { opacity: 1; }
}
@media (max-width: 720px) {
  .work-summary { padding: 14px; }
  .summary-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .summary-stat b { font-size: 17px; }
  .case-row { grid-template-columns: 30px minmax(0, 1fr) 82px 24px; gap: 9px; padding: 10px 12px; }
  .case-row .case-time, .case-row .case-status { display: none; }
  .record-paper { padding: 22px 18px 18px; border-radius: 10px; }
  .record-title { font-size: 19px; }
  .record-section p, .record-narrative p { font-size: 14.5px; line-height: 1.9; }
  .record-head { padding-bottom: 12px; }
  .ai-inner { padding: 15px 14px 16px; }
  .ai-predict { grid-template-columns: 1fr; gap: 10px; }
  .ai-head .spark { width: 28px; height: 28px; }
  .case-topline { gap: 8px; flex-wrap: nowrap; }
  .case-topline .back { padding: 0 9px; height: 30px; flex: none; }
  .case-topline .back .back-text { display: none; }
  .case-topline .spacer { display: none; }
  .case-topline .chip-time { flex: none; }
  .case-topline .row.gap-6 { margin-left: auto; flex: none; }
  .case-topline .code { font-size: 15px; }
  .work-head { align-items: flex-start; }
  .work-actions { width: 100%; }
  .work-actions .btn { flex: 1; }
  .done-card { padding: 28px 20px; }
  .done-stats { gap: 6px; }
}
