:root {
  --bg: #f3f6f0;
  --panel: #ffffff;
  --border: #d9e2d0;
  --primary: #2f6f4f;
  --primary-dark: #24563d;
  --accent: #3b6ea5;
  --text: #24342c;
  --muted: #6b786f;
  --danger: #c0392b;
  --warn-bg: #fdf3d7;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 18px; background: var(--primary); color: #fff;
  position: sticky; top: 0; z-index: 20;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
.brand { font-size: 18px; font-weight: 700; letter-spacing: 1px; }
.searchbox { flex: 1; display: flex; gap: 8px; max-width: 480px; }
.top-actions { display: flex; gap: 8px; }

input, select, textarea {
  border: 1px solid var(--border); border-radius: 6px;
  padding: 7px 9px; font: inherit; color: inherit; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #a7c6a9; }
textarea { resize: vertical; width: 100%; }

.btn {
  border: 1px solid var(--border); background: #fff; color: var(--text);
  border-radius: 6px; padding: 8px 14px; cursor: pointer; font: inherit;
  transition: background .12s, border-color .12s;
}
.btn:hover { border-color: var(--primary); background: #f0f7ee; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { color: var(--danger); border-color: #e7b8b2; }
.btn-block { width: 100%; margin-top: 8px; }

.workspace {
  display: grid;
  grid-template-columns: minmax(220px, 0.70fr) minmax(300px, 0.92fr) minmax(390px, 1.42fr) minmax(225px, 0.78fr);
  gap: 12px;
  padding: 14px;
  height: calc(100vh - 60px);
}
.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; overflow-y: auto;
}
.left-panel, .right-panel, .fee-panel { display: flex; flex-direction: column; }
.center-panel { min-width: 0; }
.panel-title {
  font-weight: 700; color: var(--primary-dark); font-size: 14px;
  padding-bottom: 6px; margin-bottom: 8px;
  border-bottom: 2px solid var(--border);
}
.field-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.field-row label { width: 34px; color: var(--muted); flex-shrink: 0; font-size: 12.5px; }
.field-row input, .field-row select { min-width: 0; padding: 7px 9px; }
input, select, textarea { box-sizing: border-box; max-width: 100%; font-size: 14px; }
.field-row input, .field-row select { flex: 1; min-width: 0; width: 100%; }
.field-row .hint-field { white-space: nowrap; }
.field-row.full label { width: 40px; }
#paddress { width: 100%; }

.patient-list, .visit-history, .formula-list { display: flex; flex-direction: column; gap: 6px; }
.patient-item, .visit-item, .formula-item {
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
  cursor: pointer; transition: background .1s;
}
.patient-item:hover, .visit-item:hover, .formula-item:hover { background: #f3faf0; }
.patient-item.active { border-color: var(--primary); background: #eaf6e6; }
.patient-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }

.rx { width: 100%; min-width: 430px; border-collapse: collapse; table-layout: auto; }
.center-panel { overflow-x: auto; }
.rx th {
  background: #eef4ea; padding: 5px 6px; text-align: left;
  border: 1px solid var(--border); font-size: 12.5px; white-space: nowrap;
}
.rx td { border: 1px solid var(--border); padding: 2px; min-width: 0; }
.rx input { width: 100%; min-width: 0; border: none; padding: 6px 5px; border-radius: 4px; background: transparent; font-size: 13px; }
.rx input:focus { background: #f5fbf2; outline: 1px solid #a7c6a9; }
.rx .right { text-align: right; }
.rx td.right input { text-align: right; }
.rx .idx { text-align: center; color: var(--muted); }
.rx .del-btn { border: none; background: none; color: var(--danger); cursor: pointer; font-size: 16px; }
.rx col.n-idx { width: 26px; }
.rx col.n-name { width: 150px; }
.rx col.n-dose { width: 56px; }
.rx col.n-unit { width: 40px; }
.rx col.n-price { width: 64px; }
.rx col.n-amt { width: 64px; }
.rx col.n-del { width: 30px; }
.rx th, .rx td { overflow: hidden; text-overflow: ellipsis; }
.rx .price { display: none; }

.tool-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.hint { color: var(--muted); font-size: 12px; }

.warning-panel {
  margin-top: 10px; background: var(--warn-bg); border: 1px solid #ecdcab;
  border-radius: 8px; padding: 8px 10px; font-size: 13px;
}

.search-mini { margin-bottom: 8px; }
.search-mini input { width: 100%; }
.formula-item .fname { font-weight: 600; }
.formula-item .fdesc { color: var(--muted); font-size: 12px; margin-top: 3px; }
.formula-item .fcompose { color: var(--primary-dark); font-size: 12px; margin-top: 3px; word-break: break-all; }

.fee-box { margin-top: 4px; }
.fee-row { display: flex; align-items: center; justify-content: space-between; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.fee-row input { width: 100px; text-align: right; }
.fee-row.total { font-size: 16px; }
.money { color: var(--primary-dark); font-weight: 700; }

/* modal */
.modal-mask {
  position: fixed; inset: 0; background: rgba(20,30,20,.45);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal-mask[hidden] { display: none; }
.modal {
  background: #fff; border-radius: 12px; width: min(860px, 94vw);
  max-height: 90vh; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 12px 40px rgba(0,0,0,.3);
}
.modal-head { display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 16px; color: var(--primary-dark); }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin-bottom: 12px; }
.modal .form-grid .span2 { grid-column: span 2; }
.modal label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 3px; }
.modal input, .modal select, .modal textarea { width: 100%; }
.modal table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.modal th, .modal td { border: 1px solid var(--border); padding: 5px 7px; text-align: left; font-size: 13px; }
.modal th { background: #eef4ea; }

.pill { display: inline-block; background: #eaf5e8; color: var(--primary-dark); border-radius: 20px; padding: 2px 10px; font-size: 12px; margin-right: 6px; }

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; height: auto; }
  .aux-directory-grid { grid-template-columns: 1fr; max-height: 40vh; }
  .aux-disease-directory > summary { align-items: flex-start; flex-direction: column; gap: 2px; }
  .aux-disease-directory > summary span { margin-left: 0; }
}

/* ---------- 处方打印样式 ---------- */
#printArea { display: none; }

.prescription-sheet {
  --rx-ink: #171b19;
  --rx-line: #313936;
  color: var(--rx-ink);
  background: #fff;
  font-family: "SimSun", "Songti SC", "Noto Serif CJK SC", "Microsoft YaHei", serif;
  font-size: 12.5px;
  line-height: 1.55;
}
.rx-sheet-head { text-align: center; padding-bottom: 8px; border-bottom: 2px solid var(--rx-line); margin-bottom: 10px; }
.rx-clinic-name { font-size: 20px; letter-spacing: 3px; font-weight: 800; }
.rx-sheet-title { margin: 3px 0 1px; font-size: 28px; line-height: 1.2; letter-spacing: 9px; font-weight: 800; }
.rx-sheet-subtitle { font-size: 11px; color: #5b625f; letter-spacing: 4px; }
.rx-meta-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--rx-line); margin-bottom: -1px; }
.rx-meta-grid > div { min-height: 32px; padding: 5px 7px; border-right: 1px solid var(--rx-line); border-bottom: 1px solid var(--rx-line); display: flex; align-items: baseline; gap: 5px; }
.rx-meta-grid > div:nth-child(4n) { border-right: none; }
.rx-meta-grid > div.span2 { grid-column: span 2; }
.rx-meta-grid > div:nth-last-child(-n+2):not(.span2) { border-bottom: none; }
.rx-meta-grid span { color: #262c29; font-size: 11.5px; white-space: nowrap; font-weight: 700; }
.rx-meta-grid b { font-weight: 500; word-break: break-all; }
.rx-symptom-block { border: 1px solid var(--rx-line); padding: 7px 9px; min-height: 42px; margin-bottom: 8px; }
.rx-symptom-block span { font-weight: 700; }
.rx-rp-title { font-family: Georgia, "Times New Roman", serif; font-size: 22px; font-weight: 700; font-style: italic; margin: 4px 0 2px; }
.rx-items-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.rx-items-table th, .rx-items-table td { border: 1px solid var(--rx-line); padding: 5px 6px; vertical-align: middle; }
.rx-items-table th { background: #f1f3f2; text-align: center; font-weight: 700; }
.rx-items-table tfoot td { background: #f7f8f7; font-weight: 700; }
.rx-items-table .center { text-align: center; }
.rx-items-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.rx-items-table .rx-total-label { text-align: right; }
.rx-items-table .rx-empty { text-align: center; color: #777; padding: 14px; }
.rx-usage-panel { display: grid; grid-template-columns: 2.4fr 1fr; border: 1px solid var(--rx-line); border-top: none; }
.rx-usage-panel > div { padding: 7px 9px; border-right: 1px solid var(--rx-line); }
.rx-usage-panel > div:last-child { border-right: none; }
.rx-usage-panel span { display: block; color: #262c29; font-size: 11px; margin-bottom: 2px; font-weight: 700; }
.rx-usage-panel b { font-weight: 600; }
.rx-fee-summary { display: flex; justify-content: flex-end; align-items: center; gap: 18px; padding: 8px 2px; border-bottom: 1px dashed #777; font-weight: 700; }
.rx-grand-total { font-size: 14px; color: #0e5e43; }
.rx-advice { padding: 8px 2px; border-bottom: 1px dashed #777; min-height: 34px; font-weight: 600; }
.rx-sign-grid + .rx-advice { margin-top: 10px; padding-top: 7px; border-top: 1px dashed #777; border-bottom: none; }
.rx-sign-grid { display: grid; grid-template-columns: 1.35fr 1fr 1fr 1fr; gap: 14px; margin-top: 22px; font-size: 12px; font-weight: 600; }
.rx-sign-grid div { white-space: nowrap; }
.rx-sheet-footer { display: flex; justify-content: space-between; margin-top: 18px; padding-top: 6px; border-top: 1px solid #9da5a1; color: #555d59; font-size: 10.5px; font-weight: 600; }

.modal-print-preview { width: min(96vw, 1180px); max-width: 1180px; }
.modal-print-preview .modal-body { background: #eaf0ec; padding: 12px; }
.print-preview-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; padding: 10px 12px; border: 1px solid #d4e1d9; border-radius: 12px; background: #fff; }
.print-preview-toolbar .hint { display: block; margin-top: 3px; }
.print-preview-warning { margin: -2px 0 10px; padding: 8px 12px; border-radius: 10px; border: 1px solid #ecd58d; background: #fff8df; color: #7b5a00; font-size: 13px; }
.print-preview-wrap { overflow: auto; padding: 8px 4px 18px; display: flex; justify-content: center; }
.print-preview-page { flex: 0 0 auto; box-sizing: border-box; background: #fff; box-shadow: 0 8px 30px rgba(31, 54, 43, .18); border: 1px solid #d6ddd9; }
.print-preview-page.paper-a4 { width: 210mm; min-height: 297mm; padding: 14mm; }
.print-preview-page.paper-a5 { width: 148mm; min-height: 210mm; padding: 10mm; }
.print-preview-page.paper-a5-landscape { width: 210mm; min-height: 148mm; padding: 9mm; }
.print-preview-page.paper-a4-landscape { width: 297mm; min-height: 210mm; padding: 11mm; }

.rx-ref-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 12px; padding-bottom: 6px; border-bottom: 2px solid var(--rx-line); }
.rx-ref-no { font-size: 10.5px; color: #4f5753; white-space: nowrap; }
.rx-ref-title { margin: 0; text-align: center; font-size: 27px; line-height: 1.15; letter-spacing: 6px; font-weight: 800; }
.rx-ref-page { text-align: right; font-size: 10px; color: #68706c; white-space: nowrap; }
.rx-info-sheet { border: 1px solid var(--rx-line); border-top: none; margin-bottom: 6px; }
.rx-info-row { display: grid; grid-template-columns: 1.1fr .8fr .8fr 1.3fr; border-bottom: 1px solid var(--rx-line); }
.rx-info-row:last-child { border-bottom: none; }
.rx-info-item { min-height: 29px; padding: 5px 8px; border-right: 1px solid var(--rx-line); display: flex; align-items: baseline; gap: 3px; }
.rx-info-item:last-child { border-right: none; }
.rx-info-item b { font-weight: 600; word-break: break-all; }
.rx-address { align-items: center; }
.rx-phone { margin-left: auto; color: #5a625e; font-size: 9.5px; white-space: nowrap; }
.rx-span2 { grid-column: span 2; border-right: 1px solid var(--rx-line); }
.rx-span2 + .rx-span2 { border-right: none; }
.rx-symptom-row { grid-template-columns: 1fr; }
.rx-symptom-row .rx-info-item { border-right: none; }
.rx-rp-head { display: flex; justify-content: space-between; align-items: flex-end; margin: 8px 0 2px; padding-bottom: 2px; border-bottom: 1px solid var(--rx-line); }
.rx-rp-word { font-family: Georgia, "Times New Roman", serif; font-size: 24px; line-height: 1; font-weight: 700; font-style: italic; }
.rx-dose-badge { font-weight: 700; font-size: 13px; }
.rx-drug-area { position: relative; min-height: 245px; padding: 5px 0 8px; border-bottom: 1px solid var(--rx-line); }
.rx-drug-grid { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px 22px; align-content: start; }
.rx-drug-cell { display: flex; justify-content: space-between; gap: 8px; padding: 4px 2px; border-bottom: 1px dotted #b5bcb8; font-size: 12.5px; }
.rx-drug-name { font-weight: 400; }
.rx-drug-dose { white-space: nowrap; font-variant-numeric: tabular-nums; }
.rx-drug-list { min-height: 220px; padding: 5px 0 8px; border-bottom: 1px solid var(--rx-line); }
.rx-drug-columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 18px; row-gap: 6px; align-content: start; }
.rx-drug-empty { grid-column: 1 / -1; color: #777; text-align: center; padding: 18px; }
.rx-drug-watermark { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: rgba(21, 90, 64, .045); font-size: 38px; font-weight: 800; letter-spacing: 9px; pointer-events: none; user-select: none; z-index: 0; }
.rx-bottom-sheet { padding-top: 6px; }
.rx-usage-line { min-height: 30px; padding: 5px 0; border-bottom: 1px dashed #8e9692; }
.rx-fee-line { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--rx-line); }
.rx-grand-total { color: #0e5e43; font-size: 13px; }
.rx-bottom-sign { display: flex; align-items: center; gap: 15px; padding-top: 16px; }
.rx-doctor-sign { margin-left: auto; }
.rx-sign-grid .rx-doctor-sign { margin-left: 0; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 2px 4px; min-width: 0; }
.rx-sign-grid .rx-doctor-sign b { white-space: nowrap; }
.rx-sign-line { flex: 1; min-width: 55px; height: 13px; border-bottom: 1px solid var(--rx-line); margin-left: 3px; }
.rx-sign-hint { flex-basis: 100%; text-align: right; color: #747c78; font-size: 8px; line-height: 1.2; }
.rx-e-signature { font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif; font-size: 1.18em; color: #154c36; }
.rx-ref-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; padding-top: 6px; border-top: 1px solid #aeb5b1; color: #626a66; font-size: 9px; }

.paper-a5 .prescription-sheet { font-size: 10.5px; line-height: 1.38; }
.paper-a5 .rx-ref-head { padding-bottom: 4px; }
.paper-a5 .rx-ref-title { font-size: 22px; letter-spacing: 3px; }
.paper-a5 .rx-ref-no { font-size: 9px; }
.paper-a5 .rx-ref-page { font-size: 8.5px; }
.paper-a5 .rx-info-item { min-height: 25px; padding: 4px 6px; }
.paper-a5 .rx-drug-area { min-height: 220px; }
.paper-a5 .rx-drug-grid { gap: 5px 13px; }
.paper-a5 .rx-drug-cell { padding: 3px 1px; font-size: 11px; }
.paper-a5 .rx-drug-list { min-height: 220px; }
.paper-a5 .rx-drug-columns { column-gap: 10px; row-gap: 4px; }
.paper-a5 .rx-rp-word { font-size: 20px; }
.paper-a5 .rx-bottom-sign { padding-top: 11px; font-size: 9.5px; gap: 9px; }
.paper-a5 .rx-usage-line,
.paper-a5 .rx-fee-line { font-size: 10px; }
.paper-a5 .rx-ref-footer { margin-top: 7px; padding-top: 4px; font-size: 8px; }
.paper-a5 .rx-sheet-head { padding-bottom: 4px; margin-bottom: 5px; }
.paper-a5 .rx-clinic-name { font-size: 18px; letter-spacing: 2px; font-weight: 800; }
.paper-a5 .rx-sheet-title { font-size: 24px; letter-spacing: 4px; font-weight: 800; }
.paper-a5 .rx-sheet-subtitle { font-size: 9px; letter-spacing: 2px; }
.paper-a5 .rx-meta-grid > div { min-height: 22px; padding: 3px 5px; }
.paper-a5 .rx-meta-grid span { font-size: 9.5px; }
.paper-a5 .rx-symptom-block { min-height: 28px; padding: 4px 6px; margin-bottom: 4px; }
.paper-a5 .rx-rp-title { font-size: 16px; margin: 2px 0 0; }
.paper-a5 .rx-items-table th,
.paper-a5 .rx-items-table td { padding: 3px 4px; }
.paper-a5 .rx-usage-panel > div { padding: 4px 6px; }
.paper-a5 .rx-fee-summary { padding: 4px 2px; gap: 10px; font-size: 10px; }
.paper-a5 .rx-advice { min-height: 22px; padding: 4px 2px; }
.paper-a5 .rx-sign-grid { margin-top: 11px; gap: 8px; font-size: 9.5px; grid-template-columns: 1.2fr 1fr 1fr 1fr; }
.paper-a5 .rx-sign-hint { font-size: 7px; }
.paper-a5 .rx-sheet-footer { margin-top: 7px; padding-top: 3px; font-size: 8.5px; }

.paper-a5-landscape .prescription-sheet { font-size: 10.5px; line-height: 1.35; }
.paper-a5-landscape .rx-sheet-head { padding-bottom: 4px; margin-bottom: 5px; }
.paper-a5-landscape .rx-clinic-name { font-size: 12px; }
.paper-a5-landscape .rx-sheet-title { font-size: 20px; letter-spacing: 6px; }
.paper-a5-landscape .rx-sheet-subtitle { font-size: 9px; letter-spacing: 2px; }
.paper-a5-landscape .rx-meta-grid > div { min-height: 22px; padding: 3px 5px; }
.paper-a5-landscape .rx-meta-grid span { font-size: 9.5px; }
.paper-a5-landscape .rx-symptom-block { min-height: 28px; padding: 4px 6px; margin-bottom: 4px; }
.paper-a5-landscape .rx-rp-title { font-size: 16px; margin: 2px 0 0; }
.paper-a5-landscape .rx-items-table th,
.paper-a5-landscape .rx-items-table td { padding: 3px 4px; }
.paper-a5-landscape .rx-usage-panel > div { padding: 4px 6px; }
.paper-a5-landscape .rx-fee-summary { padding: 4px 2px; gap: 12px; }
.paper-a5-landscape .rx-advice { min-height: 22px; padding: 4px 2px; }
.paper-a5-landscape .rx-sign-grid { margin-top: 11px; gap: 8px; font-size: 10.5px; }
.paper-a5-landscape .rx-sheet-footer { margin-top: 7px; padding-top: 3px; font-size: 9px; }

@media print {
  @page { size: 148mm 210mm; margin: 0; }
  html, body { margin: 0 !important; padding: 0 !important; width: auto !important; height: auto !important; overflow: visible !important; background: #fff !important; }
  body > *:not(#printArea) { display: none !important; }
  #printArea, #printArea * { visibility: visible !important; }
  #printArea { display: block !important; position: static !important; left: auto; top: auto; width: 148mm !important; min-height: 210mm !important; max-width: 148mm !important; box-sizing: border-box; padding: 0; background: #fff; color: #000; }
  .hidden-print { display: none !important; }
  .prescription-sheet { width: 100%; font-size: 11.5px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .rx-sheet-title { font-size: 24px; }
  .rx-meta-grid > div { min-height: 27px; padding: 4px 6px; }
  .rx-items-table th, .rx-items-table td { padding: 4px 5px; }
  .rx-sign-grid { margin-top: 16px; }
}


/* ---- 主导航 ---- */
.topbar { flex-wrap: wrap; gap: 8px; position: sticky; top: 0; z-index: 30; }
.mainnav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.nav-btn { border: 1px solid rgba(255,255,255,.35); background: transparent; color: #fff; border-radius: 6px; padding: 6px 12px; cursor: pointer; font: inherit; }
.nav-btn:hover { background: rgba(255,255,255,.15); }
.nav-btn.on { background: #fff; color: var(--primary-dark); font-weight: 600; }
.top-actions { display: flex; gap: 6px; }

/* ---- 页面容器 ---- */
#pageView { padding: 14px; min-height: calc(100vh - 70px); }
.page-loading, .page-error { padding: 40px; text-align: center; color: var(--muted); background: #fff; border-radius: 10px; border: 1px solid var(--border); }
.page-error { color: var(--danger); }
.pg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 14px; }
.pg-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.pg-card h3 { margin: 0 0 10px; color: var(--primary-dark); font-size: 15px; }
.pg-card .span2 { grid-column: span 2; }
.pg-card.span2 { grid-column: span 2; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.toolbar input { width: 220px; }
.range-filter { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 3px 8px; border: 1px solid var(--border); border-radius: 9px; background: #f8fbf9; }
.range-filter .range-label { color: #486355; font-size: 12px; font-weight: 700; white-space: nowrap; }
.range-filter .range-sep, .range-filter .range-unit { color: #7a8b80; font-size: 12px; white-space: nowrap; }
.range-filter input { width: 140px; min-width: 0; border: 1px solid #d8e4dc; border-radius: 7px; padding: 5px 7px; background: #fff; }
.range-filter input[type="number"] { width: 72px; }
.range-filter input:focus { outline: none; border-color: #5c9b77; box-shadow: 0 0 0 2px rgba(74, 143, 101, .12); }
.btns-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.warn-line { background: var(--warn-bg); border: 1px solid #ecdcab; color: #7a5c00; border-radius: 8px; padding: 7px 10px; margin: 8px 0; font-size: 13px; }
.scroll-wrap { overflow: auto; }
.table-h table { min-width: 900px; }
.plist { margin: 0; padding-left: 20px; line-height: 1.9; }
.plist li { margin-top: 4px; }
.taglist { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.taglist li { background: #eef4ea; border: 1px solid var(--border); border-radius: 18px; padding: 3px 10px; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.input-row { display: flex; gap: 8px; margin-bottom: 8px; }
.input-row input { flex: 1; }
.stat-row { display: flex; flex-wrap: wrap; gap: 10px; }
.stat-card { border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px; background: #f7fbf5; min-width: 130px; }
.stat-num { font-size: 26px; font-weight: 700; color: var(--primary-dark); }
.stat-label { color: var(--muted); margin-top: 2px; }
.stat-sub { color: var(--accent); font-size: 12px; margin-top: 2px; }
.modal table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.modal th, .modal td { border: 1px solid var(--border); padding: 5px 7px; text-align: left; font-size: 13px; }
.modal th { background: #eef4ea; }
code { background: #eef4ea; padding: 1px 5px; border-radius: 4px; }


/* ========== 高端 UI 与交互增强 ========== */
[hidden]{ display: none !important; }

:root {
  --bg: #eaf2ed;
  --panel: #ffffff;
  --border: #dfe8e2;
  --primary: #1f6f54;
  --primary-dark: #17553f;
  --accent: #2f7ba7;
  --gold: #c4a259;
  --text: #1e2b26;
  --muted: #687a71;
  --danger: #c23b33;
  --warn-bg: #fff7df;
  --shadow-sm: 0 2px 6px rgba(20,60,45,.05);
  --shadow-md: 0 8px 24px rgba(20,60,45,.08);
  --shadow-lg: 0 16px 40px rgba(20,60,45,.14);
}

body {
  background: linear-gradient(160deg, #e9f3ee 0%, #f6f9f4 45%, #eef4f7 100%);
  color: var(--text);
  min-height: 100vh;
}

.topbar {
  background: linear-gradient(135deg, #164e3b 0%, #2c7a5c 55%, #3f8e72 100%);
  box-shadow: 0 8px 22px rgba(20,60,45,.28);
  border-bottom: 3px solid rgba(196,162,89,.4);
}
.brand {
  font-size: 20px;
  letter-spacing: 1.5px;
  text-shadow: 0 1px 3px rgba(0,0,0,.18);
}
.mainnav .nav-btn {
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px;
  padding: 7px 17px;
  font-weight: 500;
  letter-spacing: .3px;
  transition: all .18s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,.06);
}
.mainnav .nav-btn:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,.24);
  border-color: #ffffff;
  box-shadow: 0 6px 14px rgba(0,0,0,.16);
}
.mainnav .nav-btn.on {
  background: #ffffff;
  color: var(--primary-dark);
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(0,0,0,.18);
}
.top-actions .btn { box-shadow: 0 3px 8px rgba(0,0,0,.12); }

.btn {
  border-radius: 10px;
  box-shadow: 0 3px 8px rgba(20,60,45,.06);
  transition: transform .16s ease, box-shadow .16s ease, background .16s, border-color .16s;
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 7px 16px rgba(20,60,45,.12);
}
.btn-primary {
  background: linear-gradient(135deg, #1f6f54, #2c8a68);
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(31,111,84,.28);
}
.btn-primary:hover { box-shadow: 0 10px 22px rgba(31,111,84,.38); }
.btn-danger:hover { box-shadow: 0 6px 14px rgba(194,59,51,.18); }
.btn-sm { border-radius: 8px; }

.panel, .pg-card {
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(223,232,226,.9);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  transition: transform .18s ease, box-shadow .18s ease;
}
.panel:hover, .pg-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.panel-title { color: var(--primary-dark); }
.pg-card h3 { color: #1d604a; border-bottom: 2px solid #eef3ec; padding-bottom: 8px; }

input, select, textarea {
  border-radius: 9px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:hover, select:hover, textarea:hover { border-color: #7fc4a7; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #2c8a68;
  box-shadow: 0 0 0 3px rgba(44,138,104,.15);
}

table { border-collapse: separate; border-spacing: 0; }
table thead th {
  background: linear-gradient(180deg, #eff7f0, #e5f1e7);
  color: #1d604a;
  font-weight: 700;
  letter-spacing: .3px;
}
table tbody tr { transition: background .14s ease; }
table tbody tr:hover { background: #f0f9f2; }
table td, table th { border: 1px solid var(--border); }

.stat-card {
  border-radius: 14px;
  background: linear-gradient(160deg, #ffffff, #eef6f0);
  border: 1px solid rgba(223,232,226,.9);
  box-shadow: 0 6px 18px rgba(20,60,45,.06);
  transition: transform .18s ease, box-shadow .18s ease;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(20,60,45,.12); }

.patient-item, .visit-item, .formula-item {
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(20,60,45,.04);
  transition: transform .15s ease, box-shadow .15s ease, background .15s;
}
.patient-item:hover, .visit-item:hover, .formula-item:hover {
  transform: translateX(3px);
  box-shadow: 0 5px 14px rgba(20,60,45,.10);
}

.modal-mask { background: rgba(16,35,27,.55); backdrop-filter: blur(3px); }
.modal {
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.7);
  box-shadow: 0 24px 70px rgba(0,0,0,.30);
}
.modal-head {
  padding: 16px 20px;
  background: linear-gradient(120deg, #f0f7f1, #e8f2ea);
}
.modal-body { padding: 18px 20px; }

.warn-line { border-radius: 12px; box-shadow: 0 3px 8px rgba(122,92,0,.06); }
.toolbar { background: rgba(255,255,255,.7); border: 1px solid rgba(223,232,226,.8); border-radius: 14px; padding: 10px; box-shadow: var(--shadow-sm); }

.toast {
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(0,0,0,.16);
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #9fc3b0; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #6ea589; }

/* 中药 / 西药 编辑弹窗分组 */
.med-section { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px 4px; margin-bottom: 12px; background: #fbfdfc; }
.med-section h4 { margin: 0 0 10px; padding: 6px 12px; border-radius: 8px; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.med-section .form-grid { margin-bottom: 0; }
.med-section textarea { width: 100%; box-sizing: border-box; }
.modal .med-section label { font-weight: 600; }
.med-common { border-color: #b7c9c0; }
.med-common h4 { background: #eef4f1; color: var(--primary-dark); }
.med-tcm { border-color: #b8d6b1; border-left: 4px solid #4a8b3f; }
.med-tcm h4 { background: #eaf4e4; color: #2f6d26; }
.med-west { border-color: #a8c7de; border-left: 4px solid #3178a8; }
.med-west h4 { background: #e7f0f8; color: #1d5c8a; }
.modal-actions { margin-top: 12px; text-align: right; }

/* 开方工作台新增按钮与快捷键提示 */
.btn-danger-outline { border: 1px solid rgba(194,59,51,.45); color: #c23b33; background: #fff; }
.btn-danger-outline:hover { background: #fdf1f0; box-shadow: 0 6px 14px rgba(194,59,51,.15); }
.btn-primary-outline { border: 1px solid rgba(31,111,84,.45); color: var(--primary-dark); background: #fff; }
.btn-primary-outline:hover { background: #f0f7ee; box-shadow: 0 6px 14px rgba(31,111,84,.15); }
.shortcut-hint { color: var(--muted); font-size: 12px; margin: 8px 0 4px; line-height: 1.6; }
.rx-live-shortcuts { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin: 0 0 9px; padding: 7px 8px; border: 1px solid #d9e5dd; border-radius: 9px; background: #f5faf7; font-size: 10.5px; line-height: 1.3; }
.rx-live-shortcuts b { margin-right: 2px; color: #365e49; font-size: 10.5px; }
.rx-live-shortcuts span { display: inline-flex; align-items: center; gap: 3px; padding: 3px 6px; border: 1px solid #dce7e0; border-radius: 999px; background: #fff; color: #617268; white-space: nowrap; }
.rx-live-shortcuts kbd { color: #245b40; font-family: inherit; font-size: 10px; font-weight: 800; }
#btnAuxTcm, #btnAuxWest { margin-right: 6px; }
#btnClearRx { margin-right: 10px; }
.formula-item:hover { border-color: var(--primary) !important; transform: translateY(-1px); }

/* 更多方药推荐 + 快捷键帮助卡片 */
.aux-cats { margin: 8px 0; padding: 8px 10px; background: #f2f8f3; border-radius: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cat-pill { border-radius: 999px; padding: 2px 10px; font-size: 12px; background: #eaf4e4; color: #2f6d26; }
.cat-pill[data-cat="秘方"] { background: #fdf1e3; color: #9a5b10; }
.cat-pill[data-cat="时方"] { background: #e7f0f8; color: #1d5c8a; }
.cat-pill[data-cat="效方"] { background: #fceef0; color: #a0394a; }
.aux-item { transition: transform .12s ease, box-shadow .12s ease; }
.aux-item:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(20,60,45,.1); }
.aux-head { margin-bottom: 4px; }
.aux-head b { font-size: 15px; }
.aux-note { color: var(--muted); font-size: 12px; margin-top: 3px; }
.aux-search-panel { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.aux-search-panel input { flex: 1; min-width: 0; padding: 11px 13px; border-radius: 11px; border: 1px solid #c9dbcf; background: #fff; font-size: 14px; }
.aux-search-panel input:focus { outline: none; border-color: #5c9b77; box-shadow: 0 0 0 3px rgba(74, 143, 101, .12); }
.aux-quick-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 7px 0; }
.aux-quick-tag { border: 1px solid #cfe1d5; border-radius: 999px; background: #f6fbf7; color: #3b7152; padding: 4px 11px; font-size: 11.5px; cursor: pointer; }
.aux-quick-tag:hover { border-color: #6fa987; background: #eaf6ee; }
.aux-quick-tag.primary { border-color: #9fc9ad; background: #eaf5ed; color: #245b3d; font-weight: 700; }
.aux-quick-tag.primary:hover { background: #dcefe2; }
.aux-quick-tag.ni-core { border-color: #d3b46a; background: #fff8df; color: #75540d; font-weight: 700; }
.aux-quick-tag.ni-core:hover { background: #fbedbd; border-color: #bf9740; }
.aux-disease-directory { margin: 7px 0 8px; border: 1px solid #d7e5dc; border-radius: 11px; background: #fbfdfb; overflow: hidden; }
.aux-disease-directory > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; color: #315f45; cursor: pointer; user-select: none; list-style: none; }
.aux-disease-directory > summary::-webkit-details-marker { display: none; }
.aux-disease-directory > summary::after { content: "展开"; color: #7a9182; font-size: 11px; }
.aux-disease-directory[open] > summary::after { content: "收起"; }
.aux-disease-directory > summary span { margin-left: auto; color: #829489; font-size: 11px; }
.aux-directory-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-height: 34vh; overflow-y: auto; padding: 0 10px 11px; }
.aux-directory-group { padding: 8px 9px; border: 1px solid #e1ebe4; border-radius: 9px; background: #fff; }
.aux-directory-group h4 { margin: 0 0 6px; color: #315f45; font-size: 12.5px; }
.aux-directory-links { display: flex; flex-wrap: wrap; gap: 4px; }
.aux-disease-link { padding: 2px 8px; border: 1px solid #e1ebe4; border-radius: 999px; background: #f7faf8; color: #5d7164; font-size: 11px; cursor: pointer; }
.aux-disease-link:hover, .aux-disease-link:focus { outline: none; border-color: #79ad8a; background: #eaf5ed; color: #285d3e; }
.aux-disclaimer { margin: 7px 0; padding: 8px 11px; border: 1px solid #eadba9; border-radius: 9px; background: #fffaf0; color: #7d641c; font-size: 11.5px; line-height: 1.6; }
.aux-context { padding: 8px 11px; border-radius: 9px; background: #f1f8f3; color: #4d6557; font-size: 12.5px; line-height: 1.6; }
.aux-result-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 9px 1px 7px; color: #7a8a80; font-size: 11.5px; }
.aux-result-list { max-height: 52vh; overflow-y: auto; display: grid; gap: 9px; padding-right: 4px; }
.aux-formula-card { padding: 12px 14px; border: 1px solid #d8e5dc; border-radius: 12px; background: linear-gradient(180deg,#fff,#f8fbf9); cursor: pointer; transition: border-color .16s, box-shadow .16s, transform .16s; }
.aux-formula-card:hover, .aux-formula-card:focus { outline: none; border-color: #75a98b; box-shadow: 0 8px 20px rgba(44, 93, 65, .12); transform: translateY(-1px); }
.aux-formula-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 5px; }
.aux-formula-head b { color: #1f5a3e; font-size: 15px; }
.aux-formula-syndrome { color: #3f7455; font-size: 12.5px; font-weight: 600; }
.aux-formula-symptoms { margin-top: 3px; color: #5f7167; font-size: 12.5px; line-height: 1.55; }
.aux-formula-compose { margin-top: 5px; padding: 6px 8px; border-radius: 7px; background: #f4f8f5; color: #52645a; font-size: 12px; line-height: 1.55; }
.aux-formula-note { margin-top: 4px; color: #849189; font-size: 11.5px; }
.aux-formula-action { margin-top: 7px; text-align: right; color: #3c8060; font-size: 11.5px; font-weight: 700; }
.aux-empty { padding: 32px 16px; text-align: center; color: #87958c; background: #f8fbf9; border: 1px dashed #cfddd4; border-radius: 12px; font-size: 13px; }
.shortcut-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.shortcut-table th, .shortcut-table td { border: 1px solid var(--border); padding: 7px 9px; text-align: left; font-size: 13px; }
.shortcut-table th { background: #eef4ea; }
.shortcut-table tr:hover { background: #f7fbf5; }

/* 欠款状态徽章 */
.debt-open { background: #fcecea; color: #a93226; border: 1px solid #e6b8af; }
.debt-done { background: #e6f4ea; color: #1e7d43; border: 1px solid #b7dfc3; }
.member-lv { font-weight: 600; }

#printArea .pa-clinic { text-align:center; color:#52615a; font-size:13px; letter-spacing:1px; margin-bottom:2px; }

.fee-panel { min-width: 0; }
.fee-panel .fee-box .fee-row input { width: 100%; }
.rx-live-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rx-live-badge { padding: 2px 7px; border-radius: 999px; color: #236443; background: #e5f4ea; font-size: 10px; font-weight: 700; }
.rx-live-note { margin: -4px 0 7px; color: #6f8075; font-size: 10.5px; line-height: 1.5; }
.live-prescription-preview { margin: -2px 0 12px; padding: 6px; border: 1px solid #d7e4db; border-radius: 10px; background: #eaf1ec; overflow-x: hidden; flex: 0 0 auto; }
.live-preview-viewport { width: 100%; overflow: hidden; }
.live-preview-page { position: relative; width: 100%; box-sizing: border-box; padding: 14px 13px; background: #fff; box-shadow: 0 7px 24px rgba(31,57,42,.18); }
.live-preview-page .prescription-sheet { font-size: 16px; line-height: 1.5; }
.live-preview-page .rx-sheet-head { padding-bottom: 8px; margin-bottom: 9px; }
.live-preview-page .rx-clinic-name { font-size: 26px; letter-spacing: 3px; }
.live-preview-page .rx-sheet-title { font-size: 32px; letter-spacing: 6px; }
.live-preview-page .rx-meta-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.live-preview-page .rx-meta-grid > div { min-height: 34px; padding: 6px 8px; border-right: 1px solid var(--rx-line); border-bottom: 1px solid var(--rx-line); }
.live-preview-page .rx-meta-grid > div:nth-child(2n) { border-right: none; }
.live-preview-page .rx-meta-grid > div.span2 { grid-column: span 2; border-right: none; }
.live-preview-page .rx-meta-grid > div:nth-last-child(-n+2) { border-bottom: 1px solid var(--rx-line); }
.live-preview-page .rx-meta-grid > div:last-child { border-bottom: none; }
.live-preview-page .rx-meta-grid span { font-size: 12.5px; }
.live-preview-page .rx-meta-grid b { font-size: 15px; }
.live-preview-page .rx-symptom-block { min-height: 42px; padding: 7px 9px; margin-bottom: 8px; font-size: 15px; }
.live-preview-page .rx-rp-title { font-size: 24px; margin: 6px 0 2px; }
.live-preview-page .rx-drug-list { min-height: 165px; padding: 6px 0 8px; }
.live-preview-page .rx-drug-columns { grid-template-columns: repeat(3,minmax(0,1fr)); column-gap: 16px; row-gap: 6px; }
.live-preview-page .rx-drug-cell { padding: 5px 2px; font-size: 15px; }
.live-preview-page .rx-usage-panel > div { padding: 7px 9px; }
.live-preview-page .rx-usage-panel span { font-size: 12px; }
.live-preview-page .rx-usage-panel b { font-size: 15px; }
.live-preview-page .rx-fee-summary { gap: 16px; padding: 7px 3px; font-size: 13px; }
.live-preview-page .rx-advice { min-height: 32px; padding: 7px 3px; font-size: 13px; }
.live-preview-page .rx-sign-grid { margin-top: 17px; gap: 11px; font-size: 12px; }
.live-preview-page .rx-sheet-footer { margin-top: 10px; padding-top: 5px; font-size: 10.5px; }
.fee-calc-note { margin: 2px 0 7px; color: #73827a; font-size: 10.5px; line-height: 1.5; text-align: right; }

/* 复诊同病症搜索 / 复制病历 */
.visit-search-row { margin-bottom: 6px; }
.visit-search-row input { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; font-size: 12px; }
.copy-btn { margin-top: 6px; display: inline-block; }
/* 效期分级预警 */
.warn-stack { line-height: 1.9; }
.warn-red { color: #c0392b; font-weight: 600; }
.warn-orange { color: #d2691e; font-weight: 600; }
.warn-yellow { color: #b8860b; }
/* 剂数小提示 */
.hint-field { color: var(--muted); font-size: 12px; width: auto; flex: none; }

/* 辨证类型 = 可输入 + 可下拉 */
.syndrome-combo { display: flex; flex: 1; min-width: 0; gap: 4px; align-items: center; }
.syndrome-combo input { flex: 1; min-width: 0; }
.combo-btn {
  width: 30px; height: 32px; flex-shrink: 0; cursor: pointer;
  border: 1px solid var(--border); background: #fff; border-radius: 8px;
  color: var(--primary); font-size: 13px; padding: 0; line-height: 1;
}
.combo-btn:hover { border-color: var(--primary); background: #f0f7ee; }
.syndrome-multi { display: block !important; position: relative; flex: 1; min-width: 0; }
.syndrome-multi-box { position: relative; border: 1px solid var(--border); border-radius: 10px; background: #fff; padding: 5px 6px; transition: border-color .2s, box-shadow .2s; }
.syndrome-multi-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(57, 122, 86, .1); }
.syndrome-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-height: 22px; padding: 1px 1px 4px; }
.syndrome-chip { display: inline-flex; align-items: center; gap: 3px; padding: 2px 5px 2px 8px; border: 1px solid #b5d8c3; border-radius: 999px; background: #eaf7ee; color: #236044; font-size: 12px; line-height: 1.5; }
.syndrome-chip button { border: 0; background: transparent; color: #4d8062; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 1px; }
.syndrome-chip button:hover { color: #b1392e; }
.syndrome-placeholder { color: #9aa8a0; font-size: 11.5px; padding: 2px 3px; }
.syndrome-search-row { display: flex; align-items: center; gap: 3px; }
.syndrome-search-row input { flex: 1; min-width: 0; border: 0 !important; box-shadow: none !important; background: transparent !important; padding: 4px 3px !important; font-size: 13px; }
.syndrome-menu { position: absolute; z-index: 400; left: 0; right: 0; top: calc(100% + 5px); max-height: 285px; overflow-y: auto; padding: 6px; border: 1px solid #c8d9cf; border-radius: 11px; background: #fff; box-shadow: 0 14px 34px rgba(28, 69, 48, .18); }
.syndrome-menu[hidden] { display: none !important; }
.syndrome-option { display: flex !important; align-items: center; gap: 8px; width: auto !important; min-height: 31px; margin: 0 !important; padding: 5px 8px !important; border-radius: 7px; color: #344a3e !important; font-size: 12.5px !important; font-weight: 400 !important; cursor: pointer; }
.syndrome-option:hover { background: #f0f8f2; }
.syndrome-option.checked { background: #e8f5ec; color: #1d5d3e !important; }
.syndrome-option input[type="checkbox"] { flex: 0 0 auto !important; width: 14px !important; height: 14px !important; margin: 0 !important; accent-color: #3d8a61; }
.syndrome-option span { flex: 1; }
.syndrome-option-code { color: #7f9488; font-size: 10px; letter-spacing: .3px; white-space: nowrap; }
.syndrome-option em { color: #58916e; font-size: 10px; font-style: normal; }
.pulse-menu { max-height: 330px; }
.pulse-option { align-items: flex-start !important; }
.pulse-option-text { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; line-height: 1.35; white-space: normal; }
.pulse-option-text b { color: #2c4939; font-size: 12.5px; font-weight: 700; }
.pulse-option-text small { color: #83948a; font-size: 10px; }
.pulse-option-code { margin-top: 1px; color: #668576; font-size: 10px; white-space: nowrap; }
.pulse-chip { background: #edf5fb; border-color: #bdd4e5; color: #285872; }
.pulse-chip button { color: #527e97; }
.rx-inline-label { font-weight: 700; }
.syndrome-no-result { padding: 13px 8px; text-align: center; color: #8c9c93; font-size: 12px; }

/* ===== 低库存滚动警示条 ===== */
.stock-ticker{position:fixed;left:0;right:0;bottom:0;height:34px;line-height:34px;background:linear-gradient(90deg,#7b1e1e,#a32d2d 50%,#7b1e1e);color:#fff;font-size:15px;font-weight:600;overflow:hidden;z-index:200;box-shadow:0 -3px 10px rgba(0,0,0,.35);white-space:nowrap;border-top:2px solid #ffd27f}
.stock-ticker[hidden]{display:none}
.stock-ticker .ticker-track{display:inline-flex;align-items:center;white-space:nowrap;animation:tickerScroll 30s linear infinite;will-change:transform}
.stock-ticker .ticker-text{padding-right:60px;flex:0 0 auto}
@keyframes tickerScroll{from{transform:translateX(var(--ticker-start,100%))}to{transform:translateX(var(--ticker-end,-50%))}}
.stock-ticker .ticker-warn{color:#ffd27f;margin-right:8px}






/* ============ 设置页布局优化 ============ */
.pg-grid { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }
.pg-card { min-width: 0; }
.pg-card .card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid #eef3ec; }
.pg-card .card-head h3 { margin: 0; border-bottom: none; padding-bottom: 0; }
.pg-card .card-head .btn { margin: 0; }
.pg-card table { width: 100%; min-width: 0; }
.pg-card .table-h { overflow-x: auto; width: 100%; }
.pg-card .table-h table { min-width: 560px; table-layout: auto; }
.pg-card table th, .pg-card table td { padding: 9px 10px; font-size: 13px; line-height: 1.55; vertical-align: middle; overflow-wrap: anywhere; }
.pg-card table th { white-space: nowrap; }
.pg-card table td { white-space: normal; }
.pg-card table td:last-child { white-space: nowrap; }
.pg-card .form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 14px; }
.pg-card .form-grid input, .pg-card .form-grid select { width: 100%; box-sizing: border-box; }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li { position: relative; padding: 9px 12px 9px 46px; margin-bottom: 8px; background: #f6fbf7; border: 1px solid #e2eee6; border-radius: 10px; font-size: 13.5px; line-height: 1.7; }
.steps li::before { counter-increment: step; content: counter(step); position: absolute; left: 10px; top: 10px; width: 26px; height: 26px; background: var(--primary); color: #fff; border-radius: 50%; text-align: center; line-height: 26px; font-weight: 700; font-size: 13px; }
.steps li b { color: var(--primary-dark); }
.warn-box { background: #fff8e1; border: 1px solid #eedc9b; color: #7a5c00; border-radius: 10px; padding: 10px 12px; margin: 10px 0; font-size: 13px; }
.faq-hint { font-weight: 700; color: var(--primary-dark); margin: 12px 0 6px; }

/* 设置页操作与专业模板 */
.btn-icon {
  width: 32px;
  min-width: 32px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  border-radius: 8px;
}
.btn-icon:hover { transform: translateY(-1px); }
.syndrome-taglist {
  max-height: 310px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fbfdfc;
}
.syndrome-taglist li { white-space: nowrap; }
.syndrome-taglist li[hidden] { display: none; }
.template-preview {
  max-height: 112px;
  overflow: hidden;
  line-height: 1.7;
  color: #42524a;
  font-size: 12.5px;
}
.medical-template-list { max-height: 52vh; overflow-y: auto; display: grid; gap: 10px; padding-right: 4px; }
.medical-template-item { border: 1px solid #dde9e2; border-radius: 12px; padding: 12px 14px; background: linear-gradient(180deg,#fff,#f8fcf9); }
.medical-template-item[hidden] { display: none; }
.medical-template-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.medical-template-text { white-space: pre-wrap; color: #3c4a43; line-height: 1.75; font-size: 13px; background: #f5faf6; border: 1px solid #e6efe9; border-radius: 9px; padding: 9px 11px; max-height: 150px; overflow-y: auto; }
.medical-template-actions { display: flex; gap: 8px; margin-top: 9px; }
.symptom-tools { display: flex; align-items: center; gap: 8px; margin: 6px 0 8px; flex-wrap: wrap; }
.symptom-tools .hint { margin: 0; }
.clinic-preview { margin-top: 12px; border: 1px dashed #b9d2c4; border-radius: 14px; padding: 12px; background: linear-gradient(160deg,#f4faf6,#eef7f1); }
.clinic-preview-label { font-size: 12px; font-weight: 700; color: var(--primary-dark); letter-spacing: .8px; margin-bottom: 8px; }
.clinic-preview-paper { background: #fff; border: 1px solid #dbe7df; border-radius: 10px; padding: 18px 22px; box-shadow: 0 3px 12px rgba(41,91,67,.07); }
.clinic-preview-clinic { text-align: center; color: #56645d; font-size: 13px; letter-spacing: 1px; }
.clinic-preview-title { text-align: center; font-size: 21px; font-weight: 800; color: #1d604a; margin: 3px 0 12px; }
.clinic-preview-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; color: #53635b; padding: 3px 0; border-bottom: 1px dotted #edf2ee; }
.clinic-preview-sign { margin-top: 12px; text-align: right; font-size: 13px; color: #42524a; }

/* 验方 OCR 扫描 / 拍照 */
.formula-ocr-panel { border: 1px dashed #9fc4b0; border-radius: 12px; padding: 12px 14px; background: linear-gradient(160deg,#f7fcf8,#eef7f1); }
.formula-ocr-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; color: var(--primary-dark); }
.formula-ocr-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.formula-ocr-actions label.btn { margin: 0; cursor: pointer; }
.btn-success { background: linear-gradient(135deg,#2f8f5b,#216b45) !important; border-color: #216b45 !important; color: #fff !important; }
.formula-paste-box { margin: 10px 0; padding: 10px; border: 1px solid #dce9e1; border-radius: 10px; background: #fff; }
.formula-paste-box label { display: block; font-weight: 700; margin-bottom: 5px; color: var(--primary-dark); }
.formula-paste-box textarea { width: 100%; box-sizing: border-box; margin-bottom: 7px; }
.ocr-image-preview { display: flex; align-items: flex-start; gap: 10px; margin: 9px 0; padding: 8px; border: 1px solid #dce9e1; border-radius: 10px; background: #fff; }
.ocr-image-preview[hidden] { display: none; }
.ocr-image-preview img { width: 120px; max-height: 110px; object-fit: contain; border-radius: 7px; border: 1px solid #d7e2db; background: #f5f7f6; }
.ocr-quality-ok, .ocr-quality-warning { flex: 1; padding: 7px 9px; border-radius: 8px; font-size: 12.5px; line-height: 1.6; }
.ocr-quality-ok { background: #f1faf4; color: #24683e; border: 1px solid #c5e4cf; }
.ocr-quality-warning { background: #fff8e6; color: #7b5a00; border: 1px solid #e9d492; }
.ocr-status { margin-top: 8px; padding: 7px 10px; border-radius: 8px; background: #fff; border: 1px solid #dce9e1; font-size: 12.5px; color: #526159; }
.ocr-status.loading { border-color: #e7d28e; background: #fff9e8; color: #7d5d00; }
.ocr-status.success { border-color: #a9d5b7; background: #eefaf1; color: #1f6a3c; }
.ocr-status.error { border-color: #e4b6b0; background: #fff1ef; color: #9f3126; }
#ocrRawBox { margin-top: 8px; }
#ocrRawBox pre { max-height: 180px; overflow: auto; white-space: pre-wrap; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 9px; font-size: 12px; }

/* ==================== 登录界面 ==================== */
body.auth-pending { overflow: hidden; background: #edf4ef; }
body.auth-pending .topbar,
body.auth-pending main { visibility: hidden; }
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  grid-template-columns: 1.16fr .84fr;
  min-height: 100vh;
  overflow: auto;
  background: #edf4ef;
}
.login-screen[hidden] { display: none !important; }
.login-visual {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  color: #fff;
  background: #1d4b3a url("/static/images/login-doctors-user-2400x2000-v2.jpg") right center / cover no-repeat;
}
.login-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(13, 52, 38, .74) 0%, rgba(13, 52, 38, .42) 48%, rgba(13, 52, 38, .12) 100%),
    linear-gradient(0deg, rgba(11, 44, 32, .48), rgba(11, 44, 32, .04) 55%);
}
.login-visual::after {
  content: "";
  position: absolute;
  width: 680px;
  height: 680px;
  right: -180px;
  bottom: -300px;
  border: 1px solid rgba(214, 244, 224, .22);
  border-radius: 50%;
  box-shadow: 0 0 0 80px rgba(214, 244, 224, .035), 0 0 0 160px rgba(214, 244, 224, .025);
}
.login-brand {
  position: absolute;
  z-index: 2;
  top: 36px;
  left: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2.4px;
  color: rgba(255, 255, 255, .82);
}
.login-brand-mark {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, .38);
  border-radius: 12px;
  background: rgba(255, 255, 255, .13);
  color: #d5f3dd;
  font-size: 19px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2);
}
.login-hero-copy {
  position: absolute;
  z-index: 2;
  left: 8%;
  top: 26%;
  max-width: 650px;
}
.login-eyebrow {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid rgba(204, 239, 214, .34);
  border-radius: 999px;
  background: rgba(8, 47, 33, .3);
  color: #dcf4e3;
  font-size: 13px;
  letter-spacing: 2px;
  backdrop-filter: blur(8px);
}
.login-hero-copy h1 {
  margin: 24px 0 16px;
  font-family: "STKaiti", "KaiTi", "Microsoft YaHei", serif;
  font-size: clamp(58px, 5.5vw, 92px);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: 4px;
  text-shadow: 0 12px 38px rgba(4, 25, 16, .62);
}
.login-hero-copy h1 span { color: #d5f1dd; }
.login-hero-copy p {
  margin: 0;
  color: rgba(237, 250, 241, .8);
  font-size: 17px;
  letter-spacing: 1.3px;
  text-shadow: 0 2px 12px rgba(4, 25, 16, .58);
}
.login-pulse { width: 340px; max-width: 75%; margin: 25px 0 18px; color: #9fe0b4; opacity: .92; }
.login-pulse svg { display: block; width: 100%; height: auto; filter: drop-shadow(0 0 9px rgba(130, 230, 163, .42)); }
.login-features { display: flex; gap: 10px; }
.login-features span {
  padding: 6px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .18);
  color: rgba(244, 255, 248, .85);
  font-size: 12px;
  letter-spacing: 1px;
}
.login-visual-footer {
  position: absolute;
  z-index: 2;
  left: 8%;
  bottom: 34px;
  color: rgba(230, 248, 236, .55);
  font-size: 12px;
  letter-spacing: 1.5px;
}
.login-panel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 44px;
  background:
    radial-gradient(circle at 15% 5%, rgba(180, 218, 193, .4), transparent 34%),
    linear-gradient(145deg, #f7fbf8 0%, #e9f2ec 100%);
}
.login-panel::before {
  content: "";
  position: absolute;
  inset: 24px;
  border: 1px solid rgba(122, 164, 140, .16);
  border-radius: 30px;
  pointer-events: none;
}
.login-card {
  position: relative;
  width: min(455px, 100%);
  padding: 38px 40px 30px;
  border: 1px solid rgba(200, 220, 208, .95);
  border-radius: 26px;
  background: rgba(255, 255, 255, .91);
  box-shadow: 0 28px 80px rgba(43, 82, 61, .18), inset 0 1px 0 rgba(255, 255, 255, .9);
  backdrop-filter: blur(16px);
}
.login-card-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 15px;
  color: #fff;
  font-size: 22px;
  background: linear-gradient(135deg, #3f8f6b, #1e5c42);
  box-shadow: 0 10px 24px rgba(38, 111, 77, .24);
  margin-bottom: 22px;
}
.login-welcome { color: #6e8e7d; font-size: 10.5px; font-weight: 800; letter-spacing: 3px; }
.login-card h2 { margin: 5px 0 7px; color: #173f2d; font-size: 34px; font-weight: 850; letter-spacing: 1px; }
.login-subtitle { margin: 0 0 17px; color: #6d7f76; font-size: 13.5px; line-height: 1.7; }
.login-role-badge { display: inline-flex; padding: 5px 12px; border-radius: 999px; color: #276348; background: #edf8f1; border: 1px solid #cde6d6; font-size: 11.5px; font-weight: 700; margin-bottom: 24px; }
.login-card form > label { display: block; margin: 0 0 7px; color: #40564b; font-size: 12.5px; font-weight: 700; }
.login-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 14px;
  margin-bottom: 17px;
  border: 1px solid #d6e4db;
  border-radius: 13px;
  background: #fbfdfb;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.login-input-wrap:focus-within { border-color: #6ea989; background: #fff; box-shadow: 0 0 0 4px rgba(94, 159, 122, .12); }
.login-input-icon { width: 21px; text-align: center; opacity: .72; font-size: 16px; }
.login-input-wrap input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: #183e2c; font-size: 15px; padding: 13px 0; }
.login-input-wrap input::placeholder { color: #a1afa7; }
.login-password-toggle { border: 0; background: transparent; color: #54866b; font-size: 12px; cursor: pointer; padding: 5px; }
.login-options { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 3px 0 16px; }
.login-remember { display: flex; align-items: center; gap: 6px; color: #62766b; font-size: 12px; cursor: pointer; }
.login-secure { color: #8a9c92; font-size: 11px; }
.login-error { display: none; margin: 0 0 12px; padding: 9px 11px; border-radius: 9px; color: #9d3329; background: #fff1ef; border: 1px solid #ecc4be; font-size: 12.5px; line-height: 1.5; }
.login-error.show { display: block; }
.login-submit {
  width: 100%;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border: 0;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(115deg, #2f8060, #1e5d43);
  box-shadow: 0 12px 28px rgba(35, 105, 73, .3);
  font-size: 15px;
  font-weight: 750;
  letter-spacing: 1px;
  cursor: pointer;
  transition: transform .18s, box-shadow .18s, filter .18s;
}
.login-submit b { font-size: 22px; font-weight: 400; }
.login-submit:hover { transform: translateY(-2px); box-shadow: 0 16px 32px rgba(35, 105, 73, .36); filter: brightness(1.04); }
.login-submit:disabled { opacity: .72; cursor: wait; }
.login-card-footer { margin-top: 23px; padding-top: 17px; border-top: 1px solid #e5eee8; text-align: center; color: #91a198; font-size: 10.5px; letter-spacing: .5px; }
.current-user-badge { display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 999px; background: rgba(255, 255, 255, .15); color: #fff; font-size: 12px; white-space: nowrap; }
.shake { animation: loginShake .35s ease-in-out; }
@keyframes loginShake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

@media (max-width: 900px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-visual { min-height: 40vh; }
  .login-panel { min-height: auto; padding: 28px 18px 36px; }
  .login-panel::before { inset: 12px; }
  .login-hero-copy { left: 8%; top: 31%; }
  .login-hero-copy h1 { font-size: clamp(38px, 9vw, 64px); }
  .login-hero-copy p { font-size: 13px; }
  .login-pulse { margin: 15px 0 10px; }
  .login-visual-footer { bottom: 16px; left: 8%; }
  .login-card { padding: 28px 24px 24px; }
}

/* ============ 售后管理 / 客户关怀 ============ */
.after-sales-page { display: grid; gap: 14px; }
.sales-hero { background: radial-gradient(circle at 88% 15%, rgba(194,162,89,.18), transparent 26%), linear-gradient(135deg, #f9fcf8 0%, #e8f3eb 56%, #dcebe1 100%); border-color: #cfdfd4; overflow: hidden; }
.sales-hero-main { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.sales-hero h2 { margin: 4px 0 7px; color: #174f3b; font-size: clamp(21px, 2.2vw, 29px); letter-spacing: .5px; }
.sales-hero p { margin: 0; max-width: 850px; color: #607267; font-size: 13px; line-height: 1.8; }
.eyebrow { color: #8b6b24; font-size: 10px; font-weight: 800; letter-spacing: 1.8px; }
.sales-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.service-goal-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 9px; margin-top: 15px; }
.service-goal { min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1px solid rgba(94,141,113,.22); border-radius: 11px; background: rgba(255,255,255,.72); }
.service-goal b { color: #2c654b; font-size: 12px; }
.service-goal span { color: #718279; font-size: 11px; line-height: 1.55; }
.after-sales-stats { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); }
.after-sales-stats .stat-card { min-width: 0; }
.after-sales-stats .stat-card.risk { background: linear-gradient(160deg,#fff,#fff1ee); border-color: #efd4ce; }
.after-sales-stats .stat-card.risk .stat-num { color: #b34c3f; }
.after-sales-layout { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(300px, .78fr); grid-template-rows: auto auto; gap: 14px; align-items: start; }
.task-board { min-width: 0; grid-column: 1; grid-row: 1; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid #eef3ec; }
.card-head h3 { margin: 0; border-bottom: none; padding-bottom: 0; }
.card-caption { color: #87968d; font-size: 11px; }
.hero-mini { padding: 6px 10px; border-radius: 999px; background: #f0f7f2; color: #557060; font-size: 11px; }
.after-sales-toolbar input { width: 240px; }
.after-sales-toolbar select { min-width: 130px; }
.after-sales-table { min-width: 1020px; }
.after-sales-table td { vertical-align: top; }
.priority-tag { display: inline-flex; justify-content: center; min-width: 40px; padding: 3px 7px; border-radius: 6px; font-size: 11px; font-weight: 800; }
.prio-urgent { color: #8d1f17; background: #a93226; color: #fff; }
.prio-high { color: #a0441d; background: #fde9dc; }
.prio-normal { color: #476659; background: #edf5f0; }
.prio-low { color: #7b8580; background: #f1f3f2; }
.task-wait { color: #8a6419; background: #fff4d8; border: 1px solid #edd394; }
.task-contact { color: #28618c; background: #e8f2fb; border: 1px solid #bfd8ed; }
.task-done { color: #28704a; background: #e5f5eb; border: 1px solid #b8dfc8; }
.task-pause { color: #76684b; background: #f2efe7; border: 1px solid #ddd4c1; }
.task-lost { color: #8a4747; background: #f8eaea; border: 1px solid #e4c5c5; }
.task-date { font-variant-numeric: tabular-nums; color: #53665b; font-size: 12px; }
.task-date.overdue { color: #b4382e; font-weight: 800; }
.task-date.today { color: #a06c10; font-weight: 800; }
.service-type { color: #265c45; font-weight: 700; white-space: nowrap; }
.task-condition { max-width: 270px; color: #5f7066; line-height: 1.6; font-size: 12px; }
.task-actions { min-width: 260px; }
.task-actions .btn { margin: 0 4px 4px 0; }
.after-sales-side { display: grid; gap: 14px; grid-column: 2; grid-row: 1 / span 2; align-content: start; }
.automation-card { background: radial-gradient(circle at 90% 0, rgba(47,123,167,.10), transparent 30%), linear-gradient(160deg,#fff,#f3f9fc); border-color: #cfe0e9; }
.automation-metrics { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 7px; margin: 4px 0 10px; }
.automation-metrics > div { padding: 8px 5px; text-align: center; border-radius: 9px; background: rgba(255,255,255,.8); border: 1px solid #dce8ee; }
.automation-metrics b { display: block; color: #245d7c; font-size: 20px; line-height: 1.1; }
.automation-metrics span { color: #7d8e98; font-size: 10px; }
.automation-metrics .danger-text { color: #b63c32; }
.automation-copy { color: #657984; font-size: 11.5px; line-height: 1.7; }
.automation-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.auto-mini { margin-top: 4px; color: #7f8d85; font-size: 10.5px; white-space: nowrap; }
.auto-mini.is-error { color: #b23830; font-weight: 700; }
.automation-settings .form-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
.automation-settings .care-guard { margin-top: 13px; }
.template-card { background: linear-gradient(160deg,#fff,#f8fbf5); }
.template-preview { display: grid; gap: 7px; margin-bottom: 10px; }
.template-preview > div { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px solid #e2ebe4; border-radius: 9px; background: #fff; }
.template-preview b { color: #356049; font-size: 12.5px; }
.template-preview span { color: #849189; font-size: 10.5px; }
.template-content-cell { min-width: 260px; max-width: 420px; color: #63756a; font-size: 12px; line-height: 1.6; }
.status-switch { display: inline-flex; align-items: center; gap: 7px; min-width: 74px; padding: 4px 8px; border: 1px solid #dbe5df; border-radius: 999px; background: #f5f7f6; color: #7b8981; cursor: pointer; transition: all .16s ease; }
.status-switch .switch-track { position: relative; width: 28px; height: 16px; border-radius: 999px; background: #b9c5be; transition: background .16s ease; }
.status-switch .switch-dot { position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .16s ease; }
.status-switch b { font-size: 11px; font-weight: 700; }
.status-switch.on { border-color: #91c3a4; background: #eaf6ee; color: #2d6d49; }
.status-switch.on .switch-track { background: #3d9564; }
.status-switch.on .switch-dot { transform: translateX(12px); }
.status-switch:hover { box-shadow: 0 4px 10px rgba(40,96,69,.12); }
.send-identity-block { margin-top: 11px; padding: 10px 12px; border: 1px solid #dbe7df; border-radius: 10px; background: #f8fbf9; color: #61746a; font-size: 11.5px; line-height: 1.65; }
.send-identity-block > b { color: #2f6048; }
.send-identity-block p { margin: 3px 0 0; }
.template-form .form-grid, .template-library .form-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
.template-form textarea { box-sizing: border-box; width: 100%; }
.personal-send-guide { margin-top: 12px; padding: 10px 12px; border: 1px solid #d6e5dc; border-radius: 10px; background: #f5faf7; color: #5c7165; font-size: 11.5px; line-height: 1.7; }
.personal-send-guide b { color: #2c654b; }
.personal-send-guide p { margin: 3px 0 8px; }
.personal-send-guide p:last-child { margin-bottom: 0; }
.provider-config { margin-top: 11px; border: 1px solid #dce7e0; border-radius: 10px; background: #fbfdfb; overflow: hidden; }
.provider-config > summary { padding: 9px 11px; cursor: pointer; color: #315f47; font-weight: 700; font-size: 12.5px; background: #f4f9f6; }
.provider-config .form-grid { padding: 10px 11px 12px; }
.provider-price-note { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; padding: 8px 10px; border-radius: 9px; background: #f3f8fb; border: 1px solid #d8e4eb; color: #607785; font-size: 11px; line-height: 1.6; }
.provider-price-note b { color: #2d617f; }
.send-patient-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid #e2ebe5; }
.send-patient-head > div { display: flex; flex-direction: column; gap: 3px; }
.send-patient-head b { color: #245b40; font-size: 17px; }
.send-patient-head span { color: #7b8d82; font-size: 12px; }
.send-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.care-list-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px dashed #e3ebe6; }
.care-list-item:last-child { border-bottom: none; }
.care-list-item > div:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.care-list-item b { color: #2f5d47; font-size: 13px; }
.care-list-item span { color: #87958d; font-size: 11px; }
.care-date { color: #567566; font-size: 11px; white-space: nowrap; }
.empty-soft { padding: 18px 8px; text-align: center; color: #8a9890; font-size: 12px; }
.care-sop-wide { margin-top: 0; grid-column: 1; grid-row: 2; background: linear-gradient(160deg,#fff,#f7fbf8); }
.care-steps { list-style: none; margin: 0; padding: 0; counter-reset: care; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.care-steps li { counter-increment: care; position: relative; min-height: 92px; padding: 14px 12px 14px 46px; border: 1px solid #dfebe3; border-radius: 12px; background: linear-gradient(145deg,#fff,#f4faf6); font-size: 12px; line-height: 1.65; }
.care-steps li::before { content: counter(care); position: absolute; left: 12px; top: 14px; width: 25px; height: 25px; border-radius: 50%; background: #e1f1e6; color: #286448; display: grid; place-items: center; font-weight: 800; font-size: 11px; box-shadow: inset 0 0 0 1px #c5dfcf; }
.care-steps li:not(:last-child)::after { content: "→"; position: absolute; right: -10px; top: 50%; z-index: 1; transform: translateY(-50%); color: #8ab29a; font-weight: 800; }
.care-steps b { display: block; color: #355d49; margin-bottom: 1px; }
.care-steps span { color: #718279; }
.care-guard { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; padding: 10px 12px; border-radius: 10px; border: 1px solid #eed9a3; background: #fffaf0; color: #7e641d; font-size: 11.5px; line-height: 1.7; }
.care-guard b { color: #8a5d09; }
.care-methods { margin-top: 0; }
.method-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
.method-grid > div { padding: 12px; border: 1px solid #e1ebe5; border-radius: 11px; background: linear-gradient(160deg,#fff,#f7fbf8); }
.method-grid b { color: #2c654b; font-size: 13px; }
.method-grid p { margin: 5px 0 0; color: #718077; font-size: 11.5px; line-height: 1.7; }
.after-sales-form .form-section-title { margin: 16px 0 9px; padding-top: 11px; border-top: 1px solid #e5ece8; color: #2f6149; font-size: 14px; }
.after-sales-form textarea { box-sizing: border-box; width: 100%; }
.after-sales-form .form-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
@media (max-width: 1150px) {
  .after-sales-layout { grid-template-columns: 1fr; }
  .task-board, .after-sales-side, .care-sop-wide { grid-column: auto; grid-row: auto; }
  .after-sales-stats { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .service-goal-grid, .method-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .care-steps { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 700px) {
  .after-sales-stats, .service-goal-grid, .method-grid, .after-sales-form .form-grid { grid-template-columns: 1fr; }
  .care-steps { grid-template-columns: 1fr; }
  .care-steps li:not(:last-child)::after { content: "↓"; left: 50%; right: auto; top: auto; bottom: -11px; transform: translateX(-50%); }
  .sales-hero-actions { width: 100%; }
  .sales-hero-actions .btn { flex: 1; }
}

/* ========== 预约管理 / 号源叫号 ========== */
.appointment-page { display: grid; gap: 14px; }
.appointment-hero {
  background:
    radial-gradient(circle at 92% 10%, rgba(197,149,57,.14), transparent 30%),
    radial-gradient(circle at 4% 100%, rgba(36,107,76,.13), transparent 36%),
    linear-gradient(135deg,#fff,#f4faf6 58%,#fff8e9);
  border-color: #d5e5db;
}
.appointment-hero-main { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; flex-wrap: wrap; }
.appointment-hero h2 { margin: 4px 0 5px; color: #174d35; font-size: clamp(23px,2.3vw,32px); }
.appointment-hero p { margin: 0; color: #6b7f72; font-size: 13px; }
.appointment-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.appointment-url-bar { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 9px 12px; border: 1px solid #dce9e0; border-radius: 11px; background: rgba(255,255,255,.78); overflow: hidden; }
.appointment-url-bar span { color: #788b7e; font-size: 11px; white-space: nowrap; }
.appointment-url-bar b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #2d6348; font-size: 12px; }
.appointment-stats { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); }
.appointment-stats .stat-card { min-width: 0; }
.appointment-stats .stat-card.risk { background: linear-gradient(160deg,#fff,#fff1ee); border-color: #efd4ce; }
.appointment-stats .stat-card.risk .stat-num { color: #b34c3f; }
.appointment-board, .appointment-calendar, .appointment-guide { min-width: 0; }
.appointment-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.appointment-toolbar input[type="date"] { width: 145px; }
.appointment-toolbar input[type="search"] { width: 235px; }
.appointment-table { min-width: 1260px; }
.appointment-table td { vertical-align: middle; }
.queue-index { display: inline-grid; place-items: center; width: 26px; height: 26px; margin-right: 5px; border-radius: 8px; background: #edf5f0; color: #2f6a4d; font-weight: 800; }
.priority-star { display: inline-block; padding: 2px 6px; border-radius: 999px; background: #fff1cc; color: #95640b; font-size: 10px; font-weight: 800; }
.appt-no { color: #245d43; font-variant-numeric: tabular-nums; white-space: nowrap; }
.visit-type { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.visit-first { color: #1e5f86; background: #e6f2fa; }
.visit-return { color: #2e6b48; background: #e7f5ec; }
.visit-medicine { color: #8b5f18; background: #fff4d9; }
.visit-decoction { color: #6b4c84; background: #f1eaf7; }
.private-value { font-variant-numeric: tabular-nums; color: #53665b; }
.reveal-link { border: 0; padding: 1px 5px; background: transparent; color: #2f7755; font-size: 10.5px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.reveal-link:hover { color: #b78422; }
.appointment-status { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 999px; border: 1px solid transparent; font-size: 11px; font-weight: 800; white-space: nowrap; }
.appt-wait { color: #8b6419; background: #fff5dc; border-color: #ead39c; }
.appt-called { color: #1f6389; background: #e6f2fa; border-color: #bcd8ea; }
.appt-arrived { color: #256a45; background: #e7f6ec; border-color: #b6ddc5; }
.appt-done { color: #52645a; background: #eef3f0; border-color: #d5dfd9; }
.appt-cancelled { color: #7c8580; background: #f3f5f4; border-color: #dce2df; }
.appt-late { color: #a04d1c; background: #fff0e5; border-color: #efc9ae; }
.appt-no-show { color: #9e302a; background: #fdeceb; border-color: #ebc2be; }
.appointment-actions { min-width: 290px; }
.appointment-actions .btn { margin: 0 4px 4px 0; }
.appointment-calendar-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 8px; }
.appointment-day { min-width: 0; border: 1px solid #dce8e0; border-radius: 12px; background: #fbfdfb; overflow: hidden; }
.appointment-day.is-selected { box-shadow: inset 0 0 0 2px rgba(47,111,79,.28); }
.appointment-day-head { display: flex; align-items: center; justify-content: space-between; gap: 5px; padding: 9px 10px; border-bottom: 1px solid #e5eee8; background: #f2f8f4; }
.appointment-day-head b { color: #315f47; font-size: 12px; }
.appointment-day-head span { color: #7c8f83; font-size: 10px; }
.appointment-slot-list { display: grid; gap: 5px; padding: 7px; }
.appointment-slot { display: flex; align-items: center; justify-content: space-between; gap: 7px; width: 100%; padding: 6px 7px; border-radius: 8px; border: 1px solid transparent; font-size: 10px; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.appointment-slot:hover { transform: translateY(-1px); box-shadow: 0 5px 12px rgba(34,75,54,.12); }
.appointment-slot-time { white-space: nowrap; font-variant-numeric: tabular-nums; }
.appointment-slot-state { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.appointment-slot-state em { padding: 1px 5px; border-radius: 999px; background: rgba(255,255,255,.72); font-size: 9px; font-style: normal; font-weight: 900; }
.appointment-slot-state b { white-space: nowrap; font-size: 9.5px; }
.slot-open { color: #246442; background: #e9f7ee; border-color: #bee1ca; }
.slot-tight { color: #8b651b; background: #fff6de; border-color: #ead28e; }
.slot-full { color: #a13b33; background: #fdecea; border-color: #ebc2bd; }
.slot-closed { color: #6d7772; background: #eef1ef; border-color: #d7ded9; }
.calendar-meta { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 5px; color: #74847a; font-size: 11px; }
.slot-legend { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.slot-legend i { display: inline-block; width: 8px; height: 8px; margin-left: 4px; border-radius: 50%; }
.slot-legend i:first-child { margin-left: 0; }
.legend-open { background: #55a878; }
.legend-tight { background: #d7a52d; }
.legend-full { background: #d4655c; }
.legend-closed { background: #9aa29e; }
.appointment-guide-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 9px; }
.appointment-guide-grid > div { display: flex; flex-direction: column; gap: 4px; padding: 11px 12px; border: 1px solid #e0ebe4; border-radius: 11px; background: linear-gradient(150deg,#fff,#f7fbf8); }
.appointment-guide-grid b { color: #2e664a; font-size: 12px; }
.appointment-guide-grid span { color: #74847a; font-size: 11.5px; line-height: 1.65; }
.appointment-form textarea, .appointment-settings input, .appointment-slot-form input { box-sizing: border-box; width: 100%; }
.appointment-week-block { padding: 12px 14px 14px; border: 1px solid #dce9e1; border-radius: 12px; background: linear-gradient(150deg,#fbfdfb,#f4faf6); }
.appointment-week-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.appointment-week-title b { color: #285f45; font-size: 13px; }
.appointment-week-title span { color: #7c8d82; font-size: 11px; text-align: right; }
.appointment-week-schedule { overflow: hidden; border: 1px solid #dce8e0; border-radius: 10px; background: #fff; }
.appointment-week-head, .appointment-week-row { display: grid; grid-template-columns: 90px repeat(2,minmax(120px,1fr)); align-items: center; }
.appointment-week-head { padding: 8px 11px; background: #edf6f0; color: #5f7869; font-size: 11px; font-weight: 800; }
.appointment-week-row { padding: 7px 11px; border-top: 1px solid #e9f0eb; }
.appointment-week-row:nth-child(odd) { background: #fbfdfb; }
.appointment-week-row b { color: #315f47; font-size: 12px; }
.appointment-week-row label { display: inline-flex; align-items: center; gap: 7px; width: fit-content; padding: 4px 8px; border-radius: 999px; color: #687b70; background: #f2f5f3; font-size: 11px; cursor: pointer; user-select: none; }
.appointment-week-row label:has(input:checked) { color: #246442; background: #e6f5eb; }
.appointment-week-row input[type="checkbox"] { width: 15px !important; height: 15px; margin: 0; accent-color: #2f7754; }
.appointment-week-row input[type="checkbox"] + span { min-width: 24px; }
.appointment-priority-card { margin-top: 12px; padding: 14px; border: 1px solid #ead9a9; border-radius: 12px; background: #fff9e9; }
.appointment-priority-card b { display: block; color: #74571a; font-size: 16px; }
.appointment-priority-card span { color: #8b7b56; font-size: 11px; }
.appointment-priority-card p { margin: 8px 0 0; color: #6b5c37; font-size: 12px; }
.appointment-log-summary { margin-bottom: 12px; padding: 12px 14px; border: 1px solid #d8e6de; border-radius: 12px; background: #f5faf7; }
.appointment-log-summary b { display: block; color: #245b40; font-size: 16px; }
.appointment-log-summary span { color: #71847a; font-size: 12px; }
.appointment-log-summary p { margin: 7px 0 0; color: #765f2e; font-size: 12px; }
.appointment-poster-wrap { display: flex; justify-content: center; padding: 8px; background: #eef4f0; border-radius: 14px; }
.appointment-poster {
  width: min(520px,100%); padding: 34px 34px 28px; box-sizing: border-box; text-align: center; color: #174d35;
  background: radial-gradient(circle at 50% 0,#fff8df,transparent 34%),linear-gradient(150deg,#fff,#f4fbf6); border: 1px solid #cfe2d5;
}
.poster-brand { color: #b7872c; font-size: 12px; font-weight: 800; letter-spacing: .18em; }
.appointment-poster h1 { margin: 13px 0 6px; font-size: 29px; letter-spacing: .08em; }
.appointment-poster h2 { margin: 0; color: #276b4c; font-size: 22px; letter-spacing: .08em; }
.appointment-poster p { margin: 8px 0 18px; color: #788a7e; font-size: 13px; }
.poster-qr { width: min(330px,78vw); aspect-ratio: 1; margin: 0 auto; padding: 10px; border: 1px solid #d9e6dd; border-radius: 15px; background: #fff; box-shadow: 0 8px 24px rgba(32,83,56,.09); }
.poster-qr img { width: 100%; height: 100%; object-fit: contain; }
.poster-cta { margin-top: 16px; color: #fff; background: #2f7754; border-radius: 999px; padding: 10px 18px; font-size: 18px; font-weight: 800; display: inline-block; letter-spacing: .08em; }
.poster-address { margin-top: 16px; color: #52695b; font-size: 12px; }
.poster-url { margin-top: 5px; color: #88978e; font-size: 10px; word-break: break-all; }
@media (max-width: 1250px) {
  .appointment-stats { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .appointment-calendar-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
}
@media (max-width: 800px) {
  .appointment-stats, .appointment-guide-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .appointment-calendar-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .appointment-hero-actions { width: 100%; }
  .appointment-hero-actions .btn { flex: 1; }
  .appointment-toolbar { width: 100%; justify-content: flex-start; }
  .appointment-url-bar { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 520px) {
  .appointment-stats, .appointment-guide-grid, .appointment-calendar-grid { grid-template-columns: 1fr; }
  .appointment-toolbar input, .appointment-toolbar button { width: 100%; }
  .appointment-week-head, .appointment-week-row { grid-template-columns: 64px repeat(2,minmax(90px,1fr)); padding-left: 7px; padding-right: 7px; }
  .appointment-week-title { align-items: flex-start; flex-direction: column; }
  .appointment-week-title span { text-align: left; }
}
@media print {
  @page { size: A4 portrait; margin: 12mm; }
  body.printing-appointment-poster * { visibility: hidden !important; }
  body.printing-appointment-poster .appointment-poster,
  body.printing-appointment-poster .appointment-poster * { visibility: visible !important; }
  body.printing-appointment-poster .appointment-poster {
    position: fixed; left: 0; top: 0; width: 186mm; min-height: 270mm;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    border: 0; background: #fff; box-shadow: none; padding: 18mm;
  }
  body.printing-appointment-poster .poster-qr { width: 120mm; }
}
@media (min-width: 1500px) {
  .topbar { flex-wrap: nowrap; gap: 9px; }
  .brand { flex: 0 0 auto; white-space: nowrap; font-size: 18px; }
  .mainnav { flex-wrap: nowrap; gap: 3px; min-width: 0; }
  .mainnav .nav-btn { padding: 7px 10px; font-size: 12.5px; white-space: nowrap; }
  .top-actions { flex: 0 0 auto; gap: 5px; }
  .top-actions .btn, .top-actions .current-user-badge { white-space: nowrap; font-size: 12px; }
}

/* 手机访问“完整开方”时，电脑版也使用横向导航 */
.mobile-back-btn { display: none; }
@media (max-width: 760px) {
  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 7px 9px;
    padding: calc(8px + env(safe-area-inset-top,0px)) 10px 7px;
    flex-wrap: nowrap;
  }
  .brand {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 16px;
    letter-spacing: .5px;
  }
  .top-actions {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: nowrap;
  }
  .top-actions .current-user-badge,
  .top-actions #btnPatientManager,
  .top-actions #btnMedManager,
  .top-actions #btnFormulaManager { display: none; }
  .mobile-back-btn {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid rgba(255,255,255,.34);
    border-radius: 999px;
    color: #fff;
    text-decoration: none;
    background: rgba(255,255,255,.12);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
  }
  .top-actions #btnLogout {
    min-height: 34px;
    padding: 0 10px;
    border-radius: 999px;
    white-space: nowrap;
    font-size: 11px;
  }
  .mainnav {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    width: 100%;
    overflow-x: auto;
    padding: 2px 1px 5px;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }
  .mainnav::-webkit-scrollbar { display: none; }
  .mainnav .nav-btn {
    flex: 0 0 auto;
    padding: 8px 13px;
    border-radius: 999px;
    white-space: nowrap;
    font-size: 12px;
    scroll-snap-align: start;
  }
  #pageView { padding: 9px; min-height: calc(100vh - 110px); }
  .workspace { grid-template-columns: 1fr !important; height: auto !important; gap: 10px; }
  .workspace > .panel { min-height: 0; height: auto; }
  .rx-toolbar, .tool-row { flex-wrap: wrap; }
  .shortcut-hint { display: none; }
}

/* ========== 本地 / 云端混合同步 ========== */
.sync-page { display: grid; gap: 14px; }
.sync-hero { background: radial-gradient(circle at 92% 0,rgba(188,143,55,.15),transparent 28%),linear-gradient(140deg,#fff,#f3faf6); }
.sync-hero-main { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.sync-hero h2 { margin: 5px 0; font-size: clamp(24px,2.4vw,34px); }
.sync-hero p { margin: 0; color: #718279; font-size: 13px; }
.sync-stat-row { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; }
.sync-stat-row .pg-card { padding: 14px; }
.sync-stat-row b { display: block; color: #245c42; font-size: 21px; }
.sync-stat-row span { display: block; margin-top: 4px; color: #819088; font-size: 11px; }
.sync-config textarea, .sync-config input { box-sizing: border-box; }
.sync-log-message { max-width: 600px; line-height: 1.6; }
.sync-guide-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.sync-guide-grid > div { padding: 12px; border: 1px solid #dfeae3; border-radius: 11px; background: #f8fbf9; }
.sync-guide-grid b { display: block; color: #2b6549; margin-bottom: 4px; }
.sync-guide-grid span { color: #718279; font-size: 11.5px; line-height: 1.65; }
@media (max-width: 850px) {
  .sync-stat-row, .sync-guide-grid { grid-template-columns: 1fr 1fr; }
  .sync-hero-main { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 520px) {
  .sync-stat-row, .sync-guide-grid { grid-template-columns: 1fr; }
}
