/* print.css - 处方笺打印专用样式 */
/* 处方开具页面的三栏布局样式（屏幕显示） */
.rx-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 8px minmax(230px, 0.34fr);
  height: calc(100vh - 92px);
}
.rx-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}
.rx-right {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}
.rx-divider {
  cursor: col-resize;
  align-self: stretch;
  border-radius: 4px;
  background: transparent;
  position: relative;
}
.rx-divider:hover { background: var(--primary-light); }
.rx-divider::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
  border-radius: 1px;
}

/* ============ 三栏布局·窄窗口自适应（修复：中间区底部横向滑块、右侧信息列被挤出/隐藏） ============
   原则：中间工作区自适应填满剩余宽度且不产生左右横向滚动；表格在中间区内换行/压缩显示全部信息；
   右侧信息列固定宽度（可拖）并始终可见。 */
.rx-layout { min-width: 0; max-width: 100%; }
.rx-layout > * { min-width: 0; }
.rx-main { min-width: 0; overflow-x: hidden; }
.rx-right { min-width: 0; }
/* 诊疗单据标签条：单行不换行；放不下由 fitExamDocTabs 缩小字号，overflow hidden 仅作防溢出兜底 */
#exam-doc-tabs { flex-wrap: nowrap; }
#exam-doc-tabs .pet-tab { overflow: hidden; }

/* ★ 2026-10-12（用户口径）：「项目检索」下的项目列表要**铺到底**（原来 .drug-list 固定 max-height:380px，
   下方总空一大段）。.rx-main 是定高 flex 列 → 让「检查/处置工作区」按内容高度不压缩、
   「项目检索」区自动吃掉剩余高度、列表在其中滚动。 */
.rx-main > .exam-mid { flex: 0 0 auto; }
.rx-main > .exam-bottom {
  flex: 1 1 auto;
  min-height: 180px;
  display: flex;
  flex-direction: column;
}
.rx-main > .exam-bottom > .drug-list {
  flex: 1 1 auto;
  min-height: 120px;
  max-height: none;   /* 覆盖通用 .drug-list 的 380px 上限：铺满到页面底部 */
}

/* 处方开具页各区块 */
.rx-section { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 14px; box-shadow: var(--shadow); }
.rx-section-title { font-size: 14px; font-weight: 600; margin-bottom: 10px; color: var(--text); }

/* 前记信息网格 */
.rx-preamble { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 12px; }
.rx-field { display: flex; flex-direction: column; }
.rx-field .lbl { font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }

/* 药品条目卡片 */
.rx-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #fafbfd;
}
.rx-item-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.rx-item-name { font-weight: 600; font-size: 14px; }
.rx-item-spec { font-size: 12px; color: var(--text-secondary); }
.rx-item-body { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--text-secondary); }
.rx-item-body .kv b { color: var(--text); font-weight: 500; }

/* 动物信息卡片（简化显示） */
.rx-animal-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafbfd;
}
.rx-animal-info { flex: 1; }
.rx-animal-name { font-size: 16px; font-weight: 700; }
.rx-animal-meta { font-size: 13px; color: var(--text-secondary); }
.rx-animal-owner { text-align: center; min-width: 90px; }
.rx-animal-date { min-width: 140px; }
.rx-animal-label { font-size: 12px; color: var(--text-muted); }
.rx-animal-value { font-size: 14px; font-weight: 500; }

/* 处方工作区：动物信息一行 */
.rx-animal-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding: 10px 12px;
  background: #fafbfd;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 10px;
}
.al-item { display: flex; align-items: baseline; gap: 4px; font-size: 13px; }
.al-item .al-label { font-size: 12px; color: var(--text-muted); }
.al-item b { color: var(--text); }
.rx-diag-row { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.rx-diag-row .al-label { font-size: 13px; color: var(--text-secondary); font-weight: 600; white-space: nowrap; }

/* 检查页右侧诊断结论区（窄面板下 label 在上、输入在下） */
.rx-right .rx-diag-row { flex-direction: column; align-items: stretch; gap: 4px; }
.rx-right .rx-diag-row .al-label { margin-bottom: 2px; }

/* 处方药品明细表 */
.rx-item-table { font-size: 13px; }
.rx-item-table input { text-align: center; }
.rx-item-table .exam-inline-name { text-align: left; }
.rx-item-table .exam-inline-price { width: 64px; }

/* 药品选择表格（紧凑模式，一屏尽量多显示） */
.drug-list { max-height: 420px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
.drug-picker-table { font-size: 12px; line-height: 1.3; }
.drug-picker-table th,
.drug-picker-table td { padding: 3px 8px; white-space: nowrap; }
.drug-picker-table th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 1;
  font-size: 11px;
  padding: 4px 8px;
}
.drug-picker-row { cursor: pointer; }
.drug-picker-row:hover td { background: var(--primary-light); }
.drug-picker-row.selected td { background: #e0ecff; }
.drug-picker-table .btn { padding: 1px 8px; font-size: 12px; line-height: 1.4; }

/* 段落式药品详情 */
.drug-detail-card { font-size: 13px; line-height: 1.7; }
.dd-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.dd-para { margin-bottom: 6px; }
.dd-para-label {
  display: inline-block;
  min-width: 64px;
  color: var(--text-muted);
  font-weight: 600;
}
.dd-para-label::after { content: '：'; }

/* 就诊宠物表格 */
.pet-table { font-size: 13px; }
.pet-table th { white-space: nowrap; }
.pet-row { cursor: pointer; }
.pet-row:hover td { background: var(--primary-light); }
.pet-row.current td { background: #e0ecff; }
.pet-row.current td:first-child { border-left: 3px solid var(--primary); }

/* 首页记录表格（紧凑，对齐待诊/住院列表风格） */
.home-record-table { font-size: 12px; }
.home-record-table th,
.home-record-table td { padding: 5px 8px; white-space: nowrap; }
.home-record-table .btn { padding: 2px 8px; font-size: 12px; line-height: 1.5; }
.home-record-row:hover td { background: var(--primary-light); }

/* 药品/耗材库表格（紧凑） */
.lib-table { font-size: 12px; }
.lib-table th,
.lib-table td { padding: 4px 6px; white-space: nowrap; }
.lib-table .btn { padding: 1px 8px; font-size: 12px; line-height: 1.5; }
.lib-row { cursor: pointer; }
.lib-row:hover td { background: var(--primary-light); }
.lib-row.selected td { background: #e0ecff; }
.lib-row.selected td:first-child { border-left: 3px solid var(--primary); }
.lib-row.lib-low-stock td { background: #fff0f0; }
.lib-row.lib-low-stock:hover td { background: #ffe4e4; }
.lib-row.lib-low-stock.selected td { background: #ffe4e4; }
.lib-restock-cell,
.lib-manual-cell,
.lib-stock-cell { cursor: pointer; color: var(--primary); }
.lib-restock-cell:hover,
.lib-manual-cell:hover,
.lib-stock-cell:hover { text-decoration: underline; }

/* 供货商月度透视表（两行表头 + 前4列固定 + 月份色块） */
.sup-table { font-size: 12px; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.sup-table th,
.sup-table td { padding: 3px 6px; white-space: nowrap; border-bottom: 1px solid var(--border); border-right: 1px solid #f0f0f0; overflow: hidden; }
.sup-table th { position: relative; }
.sup-table thead th { position: sticky; top: 0; z-index: 3; background: #f8fafc; }
.sup-table .sup-fixed { position: sticky; z-index: 2; background: #fff; border-right: 2px solid var(--border); }
.sup-table thead .sup-fixed { background: #f8fafc; z-index: 4; }
/* 固定列左右偏移由 JS 按列宽联动设置（.sup-col-N 仅作选择器标记） */
.sup-table .col-resizer { position: absolute; top: 0; right: 0; width: 6px; height: 100%; cursor: col-resize; z-index: 6; }
.sup-table .col-resizer:hover { background: rgba(59,130,246,0.4); }
.sup-table .sup-edit-cell { cursor: text; }
.sup-table .sup-edit-cell:hover { background: #fff7e6; }
.sup-table tbody .sup-edit-cell:focus-within { background: #fffbe6; }
#sup-table-wrap { overflow: auto; max-height: calc(100vh - 300px); }
.sup-row { cursor: pointer; }
.sup-row:hover td { background: #f8fafc; }
.sup-row:hover .sup-fixed { background: #f8fafc; }
.sup-row.selected td { background: #e0ecff; }
.sup-row.selected .sup-fixed { background: #e0ecff; }
.sup-table input { padding: 1px 4px; font-size: 12px; }
.sup-btn { flex: 0 0 auto; }
/* 12 色月份底色 */
.sup-month-0 { background: #fde8e8; }
.sup-month-1 { background: #fdeee3; }
.sup-month-2 { background: #fdf6e0; }
.sup-month-3 { background: #eff9e3; }
.sup-month-4 { background: #e5f7ee; }
.sup-month-5 { background: #e0f4f7; }
.sup-month-6 { background: #e3eefc; }
.sup-month-7 { background: #eae8fb; }
.sup-month-8 { background: #f5e8f8; }
.sup-month-9 { background: #fbe7f0; }
.sup-month-10 { background: #f0f0f0; }
.sup-month-11 { background: #f7f4e8; }

/* 待诊/住院 Tab 切换（Edge 风格：整条标签条 + 激活页签顶部大圆角、下缘齐平） */
.pet-tabs,
#im-tabs,
#im-pet-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 8px 0;
  background: #e7ecf4;                 /* 标签条底色 */
  border-radius: 12px 12px 0 0;        /* 整条标签条顶部圆角 */
  align-items: flex-end;
  margin-bottom: 0;
}
/* 5 页签（药品/耗材：药品库/本院药品目录/本院耗材目录/耗材库/药品库存）：
   ★ 2026-09-23（用户反馈「有的标签文字都没显示完全」）：不再用省略号裁切——
   按钮按内容自适应宽度（flex:0 0 auto），整条标签条不被压缩；一行放不下时整条/各按钮换行显示全文。 */
.pet-tabs.tabs5 { font-size: 12.5px; flex: 1 1 100%; flex-wrap: wrap; }
.pet-tabs.tabs5 .pet-tab {
  flex: 0 0 auto;
  overflow: visible;
  text-overflow: clip;
  padding: 6px 10px 8px;
  letter-spacing: 0;
  white-space: nowrap;
}
/* ★ 2026-10-13（用户口径）：药品/耗材页·标签行右侧的流程提示小字（同一行后半段灰色小字） */
.pet-tabs .lib-flow-hint {
  margin-left: auto;
  align-self: center;
  flex: 0 0 auto;
  max-width: 60%;
  font-size: 11px;
  line-height: 1.5;
  color: #64748b;
  padding: 0 10px 4px 12px;
  text-align: right;
  cursor: default;
  user-select: none;
}
.pet-tab {
  flex: 1;
  position: relative;
  padding: 7px 12px 9px;
  border: none;
  background: rgba(255, 255, 255, 0.55);   /* 与标签条底纹略有区分（微弱底纹） */
  border-radius: 10px 10px 0 0;        /* 顶部大圆角，下缘齐平 */
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.pet-tab:hover { background: rgba(255, 255, 255, 0.85); color: var(--text); }
.pet-tab.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  z-index: 1;
}

/* ===== 页面级「小标签」（2026-09-30 用户）=====
   财务（🧾 收银台 / 💳 消费记录）、驱虫疫苗（顶部 4 个标签）：
   标签条**不再拉满整行** —— 标签按内容自适应宽度，整条贴合内容并靠左排列，右侧不再留一大片灰底。 */
.pet-tabs.tabs-left,
#im-tabs.tabs-left { width: fit-content; max-width: 100%; }
.pet-tabs.tabs-left .pet-tab,
#im-tabs.tabs-left .pet-tab { flex: 0 0 auto; }

/* ===== 财务页（🧾 收银台 / 💳 消费记录）左右两栏（★ 2026-10-12 用户口径）=====
   用户原话：「这个动物信息列表要求调整高度与几个统计框上缘齐平」（原来是横在上面的统计卡把右名单
   挤下去了 → 名单顶部比统计卡低一整行，就是「原来的高度」）。做法与平板端 `FinanceScreen` 一致：
   统计卡放进**左列内部**（.fin-left），右侧名单自己一列（.fin-rail）→ 上缘与统计卡齐平、
   并一路拉到内容区底部（能多显示几行）；名单在两个标签之间**共用同一份**（切标签不重建）。 */
.fin-shell { display: flex; gap: 12px; align-items: flex-start; }
.fin-left { flex: 1 1 auto; min-width: 0; }
.fin-rail {
  flex: 0 0 320px;
  width: 320px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  /* 内容区可视高度 = 100vh - 顶栏52 - 内容内边距40 - 页面小标签≈55，留几像素余量 */
  max-height: calc(100vh - 150px);
  /* 窗口很矮时别把名单列表挤成 0 高（宁可整页纵向滚动一点） */
  min-height: 420px;
}
.fin-rail > * { flex: 0 0 auto; }
.fin-rail-list { flex: 1 1 auto; min-height: 0; max-height: none; overflow: auto; }

/* ★ 2026-10-13（用户口径）：财务新增「🧮 薪酬计算 / 📒 记账」两个标签 —— 它们是**整宽表格**，
   不需要右侧「候诊/住院/就诊记录」名单 → 外壳变单列（右名单由 finApplyPage 隐藏） */
.fin-shell.fin-wide { display: block; }
.fin-shell.fin-wide .fin-left { width: 100%; }

/* ===== 薪酬计算表：按列分组上不同底色（★ 2026-10-14 用户口径：「采用不同底色区别人工成本、补贴垫付、社保公积金等区域」）
   pf-gcost=员工总成本 · pf-g1=人工成本 · pf-g2=补贴·垫付 · pf-g3=社保/医保/公积金 · pf-g4=支付 · pf-g0=姓名/备注 */
.pf-table th, .pf-table td { background-image: none; }
.pf-table thead th { text-align: center; }
.pf-table .pf-g0 { background: #ffffff; }
.pf-table .pf-gcost { background: #f5f3ff; }
.pf-table .pf-g1 { background: #eef6ff; }
.pf-table .pf-g2 { background: #fff7ed; }
.pf-table .pf-g3 { background: #f0fdf4; }
.pf-table .pf-g4 { background: #f8fafc; }
/* 悬停时保留分组底色（比 main.css 的 `.table tr:hover td` 更特异，否则一悬停底色全丢） */
.pf-table tbody tr:hover td.pf-g0 { background: #f1f5f9; }
.pf-table tbody tr:hover td.pf-gcost { background: #ece7fe; }
.pf-table tbody tr:hover td.pf-g1 { background: #e2eefc; }
.pf-table tbody tr:hover td.pf-g2 { background: #ffeede; }
.pf-table tbody tr:hover td.pf-g3 { background: #e2f8e9; }
.pf-table tbody tr:hover td.pf-g4 { background: #eef2f7; }
/* 合计行：用上下两条细线区分，底色仍按分组 */
.pf-table tfoot td { box-shadow: inset 0 1px 0 #cbd5e1, inset 0 -1px 0 #cbd5e1; }

/* 不在标签条上的小标签（驱虫疫苗·底部「疫苗 / 驱虫药」）：胶囊形 + 浅灰底（白色卡片上也能辨识） */
.pet-tab.pet-tab-chip {
  flex: 0 0 auto;
  background: #eef1f5;
  border-radius: 8px;
  padding: 5px 12px;
  color: var(--text-secondary);
}
.pet-tab.pet-tab-chip.active { background: var(--primary); color: #fff; font-weight: 600; }

/* 宠物列表 */
.pet-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.pet-list-item:hover { border-color: var(--primary); }
.pet-list-item.selected { border-color: var(--primary); background: var(--primary-light); }
.pet-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.pet-info { flex: 1; min-width: 0; }
.pet-name { font-weight: 600; font-size: 14px; }
.pet-sub { font-size: 12px; color: var(--text-muted); }

/* 药品详情 */
.drug-detail .dd-cat { margin-bottom: 12px; }
.drug-detail .dd-label { font-size: 12px; color: var(--text-muted); font-weight: 600; margin: 10px 0 4px; text-transform: uppercase; }
.drug-detail .dd-text { font-size: 13px; color: var(--text); }
.dosage-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.dosage-table th, .dosage-table td { border: 1px solid var(--border); padding: 5px 7px; text-align: left; }
.dosage-table th { background: #f8fafc; color: var(--text-secondary); }

/* ============ 中间区表格自适应（置于文件末尾覆盖上方表格 nowrap 规则） ============
   目标：表格铺满中间工作区、内容允许换行；页面/中间区不出现横向滑块，右栏始终可见；
   超宽的工作区项目表仅在自身容器内兜底滚动（#exam-items），不撑开页面或隐藏右栏 */
.rx-item-table, .drug-picker-table { width: 100%; }
.rx-item-table th, .rx-item-table td,
.drug-picker-table th, .drug-picker-table td {
  white-space: normal;
  overflow-wrap: anywhere;
}
.drug-picker-table th, .drug-picker-table td { padding: 3px 6px; }
.rx-item-table th, .rx-item-table td { min-width: 0 !important; padding: 3px 5px; }
.rx-item-table .exam-inline-name { min-width: 0; max-width: none; width: 100%; }
.rx-item-table input, .rx-item-table select { max-width: 100%; }
.rx-item-table select { width: 108px; min-width: 0; }
#exam-items { max-width: 100%; overflow-x: auto; }

/* ============ 全局后台任务顶部进度条（门户同步/批量刷新等待提示，固定顶部不遮内容） ============ */
#app-busy-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 9999;
  display: none;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 6px rgba(15, 23, 42, 0.12);
  border-bottom: 1px solid var(--border, #e2e8f0);
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-secondary, #475569);
  align-items: center;
  gap: 8px;
}
#app-busy-bar.show { display: flex; }
#app-busy-bar .ab-bar {
  flex: 1; height: 3px;
  border-radius: 3px;
  background: rgba(99, 102, 241, 0.15);
  overflow: hidden;
  position: relative;
}
#app-busy-bar .ab-bar i {
  position: absolute; top: 0; left: 0; height: 100%;
  width: 40%;
  border-radius: 3px;
  background: var(--primary, #4f46e5);
  animation: ab-slide 1.1s ease-in-out infinite;
}
@keyframes ab-slide {
  0% { left: -40%; }
  100% { left: 100%; }
}

/* ============ 打印样式 ============ */
@media print {
  body * { visibility: hidden; }
  #print-area, #print-area * { visibility: visible; }
  #print-area {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    display: block !important;
  }

  /* ===== 长文档流式打印（body.print-flow：费用明细 / 病历 / 护理记录 等会翻多页的文书）=====
     打印区回到正常流，其余兄弟节点 display:none；这样**每一页**都听 @page 的页边距，
     上一页末尾与下一页顶部都会留出空白（绝对定位时只有第一页按页边距定位，后续页贴边被切）。 */
  body.print-flow #print-area {
    position: static !important;
    left: auto;
    top: auto;
    width: auto;
  }
  body.print-flow > *:not(#print-area) { display: none !important; }
  body.print-flow .rx-print { padding: 0; }
  /* 行/小节不跨页拆开；表头每页重复 */
  body.print-flow tr { page-break-inside: avoid; break-inside: avoid; }
  body.print-flow thead { display: table-header-group; }
  body.print-flow tfoot { display: table-footer-group; }
  body.print-flow .mr-detail-box { max-height: none !important; overflow: visible !important; }
  body.print-flow img { max-width: 100%; }

  @page {
    size: 210mm 148mm landscape;
    margin: 8mm;
  }

  .rx-print {
    position: relative;
    font-family: "SimSun", "宋体", serif;
    font-size: 10pt;
    line-height: 1.6;
    color: #000;
    padding: 4mm;
  }
  /* PDF 底图模板：整页铺满，不留内边距，分页与 PDF 原稿一致 */
  .rx-print.pdf-print { padding: 0; }  .rx-print.pdf-print .pdf-page { page-break-after: always; break-after: page; margin: 0; box-shadow: none; }
  .rx-print.pdf-print .pdf-page:last-child { page-break-after: auto; break-after: auto; }
  .rx-print.pdf-print .pdf-page > img { width: 100%; height: 100%; }
  .rx-print.pdf-print .pdf-fld {
    position: absolute; background: #fff; overflow: hidden; white-space: nowrap;
    display: flex; align-items: flex-end; line-height: 1.1; color: #000;
    font-family: "SimSun", "宋体", serif; padding: 0 1px; box-sizing: border-box;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  /* 预设签字 / 医院盖章：透明底图片按 mm 等比打印，别被浏览器省墨模式吃掉颜色 */
  .rx-print.pdf-print .pdf-fld-img { padding: 0; background: transparent; align-items: center; justify-content: center; }
  .doc-sign-img {
    display: inline-block; vertical-align: middle; height: auto; max-width: 100%;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .rx-print .header {
    text-align: center;
    font-size: 16pt;
    font-weight: bold;
    border-bottom: 2px solid #000;
    padding-bottom: 3mm;
    margin-bottom: 3mm;
    letter-spacing: 4px;
    position: relative;
  }
  /* ★ 2026-10-17（用户口径）：单据右上角「就诊号」（病历 / 费用明细 / 处方 统一） */
  .rx-print .header .doc-no,
  .rx-print .doc-no {
    position: absolute;
    right: 0;
    top: 0;
    font-size: 9pt;
    font-weight: normal;
    letter-spacing: 0;
    color: #000;
  }
  /* ★ 2026-10-17（用户口径）：处方联次**竖排在最右侧**（原来是标题下居中一行） */
  .rx-print .rx-copy {
    position: absolute;
    right: 0;
    top: 16mm;
    writing-mode: vertical-rl;
    text-orientation: upright;
    font-size: 9pt;
    letter-spacing: 2px;
    line-height: 1;
    color: #000;
  }
  /* 有竖排联次时给右侧留出空白，避免正文顶到联次上 */
  .rx-print.rx-page-has-copy { padding-right: 9mm; }
  .rx-print .sub-header {
    text-align: center;
    font-size: 9pt;
    margin-bottom: 3mm;
  }
  /* ★ 2026-10-07（用户口径）：单据的机构信息统一放**末尾页脚**（机构名 + 地址 + 电话），
     不再放页眉抬头下面（页眉只留单据标题/联次）。 */
  .rx-print .clinic-footer {
    margin-top: 6mm;
    padding-top: 2mm;
    border-top: 1px dashed #999;
    text-align: center;
    font-size: 9pt;
    line-height: 1.5;
    letter-spacing: 1px;
  }
  .rx-print .preamble {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 1mm 6mm;
    font-size: 9pt;
    margin-bottom: 3mm;
  }
  .rx-print .preamble span { white-space: nowrap; }
  .rx-print .diagnosis {
    border-top: 1px solid #000;
    border-bottom: 1px solid #000;
    padding: 2mm 0;
    margin: 2mm 0;
    font-size: 10pt;
  }
  .rx-print .rp-title { font-weight: bold; margin-bottom: 1mm; }
  .rx-print .rp-items { min-height: 70mm; }
  .rx-print .rp-items .item {
    padding: 1mm 0;
    font-size: 9.5pt;
  }
  .rx-print .item-line1 { font-weight: bold; }
  .rx-print .item-line2 { font-size: 8.5pt; }
  .rx-print .blank-mark {
    text-align: center;
    border-top: 1px dashed #000;
    padding-top: 2mm;
    margin-top: 3mm;
    font-size: 9pt;
  }
  .rx-print .postscript {
    display: flex;
    justify-content: space-between;
    margin-top: 5mm;
    font-size: 10pt;
  }
  .rx-print .rx-print-price {
    display: flex;
    justify-content: flex-end;
    gap: 8mm;
    margin-top: 2mm;
    font-size: 10pt;
    border-top: 1px solid #000;
    padding-top: 2mm;
  }

  /* 排班表打印样式 */
  .schedule-print {
    font-family: "SimSun", "宋体", serif;
    color: #000;
  }
  .schedule-print .sp-header {
    text-align: center;
    font-size: 16pt;
    font-weight: bold;
    margin-bottom: 4mm;
    letter-spacing: 2px;
  }
  .schedule-print .sp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9pt;
  }
  .schedule-print .sp-table th,
  .schedule-print .sp-table td {
    border: 1px solid #000;
    padding: 1.5mm 2mm;
    text-align: center;
    white-space: nowrap;
  }
  .schedule-print .sp-table th { background: #f0f0f0; }
  .schedule-print .sp-footer { text-align: center; margin-top: 3mm; font-size: 9pt; }

  /* 检查处置单打印样式 */
  .exam-print-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10pt;
    margin-top: 3mm;
  }
  .exam-print-table th,
  .exam-print-table td {
    border: 1px solid #000;
    padding: 2mm 2mm;
    text-align: center;
  }
  .exam-print-table th { background: #f0f0f0; }
  .exam-print-foot {
    display: flex;
    justify-content: space-between;
    margin-top: 4mm;
    font-size: 10pt;
    border-top: 1px solid #000;
    padding-top: 2mm;
  }
  .exam-print-diag { margin-top: 4mm; font-size: 10pt; }
  .exam-print-diag-detail { margin-top: 2mm; font-size: 10pt; min-height: 20mm; border-bottom: 1px dashed #000; }
}

/* 检查页费用面板（屏幕显示） */
.exam-price-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.exam-price-row:last-child { border-bottom: none; }
.exam-price-row .ep-label { color: var(--text-secondary); }

/* 检查单底部费用汇总行（一行显示）
   ★ 2026-10-18（用户口径）：检查单/处置单/处方底部「医生·总价」这一行高度缩到约原来的 30%。
     只压高度不删内容：padding 8px→2px、输入框 36px→20px、字号 13→12、行高 1.15。 */
.exam-cost-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 2px 8px;
  margin-top: 4px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.15;
  color: var(--text-secondary);
}
.exam-cost-bar > span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.exam-cost-bar .input { height: 20px; padding: 0 5px; font-size: 12px; line-height: 18px; }
.exam-cost-bar b { color: var(--text); font-weight: 600; }

/* ★ 2026-10-18（用户口径）：处方「诊断结论 + 开具时间」那一行同样压矮（输入框 36px→20px，按天按钮同高）
   并且**强制单行**（原来窄一点就会折成 2~3 行、白占高度）；放不下就把末尾那句提示文字省略 */
.rx-issue-row { gap: 8px !important; flex-wrap: nowrap !important; overflow: hidden; align-items: center; }
.rx-issue-row .input { height: 20px; padding: 0 5px; font-size: 11.5px; line-height: 18px; }
.rx-issue-row .al-label, .rx-issue-row label { font-size: 11px !important; }
.rx-issue-row .btn-sm { height: 20px; padding: 0 6px; font-size: 11px; line-height: 18px; }
.rx-issue-row #rx-issue-box { flex: 0 1 auto; min-width: 0; flex-wrap: nowrap !important; }
.rx-issue-row #rx-issue-box > div { flex-wrap: nowrap !important; align-items: center; }
.rx-issue-row #rx-issue-date { width: 175px !important; min-width: 0; }
.rx-issue-row #rx-mode-hint {
  flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 10px !important;
}

/* ================= 麻醉监护（★ 2026-10-18，用户口径） ================= */
.anes-toolbar { display: flex; align-items: center; gap: 8px; margin: 6px 0 10px; flex-wrap: wrap; }
.anes-section { min-height: 0; }
.anes-wrap { overflow: auto; }
.anes-tbl { border-collapse: collapse; width: 100%; font-size: 12px; }
.anes-tbl th, .anes-tbl td { border: 1px solid var(--border); padding: 1px 2px; text-align: center; white-space: nowrap; }
.anes-tbl th { background: #f8fafc; font-weight: 600; font-size: 11.5px; }
.anes-in { border: 0; background: transparent; width: 100%; font-size: 12px; padding: 2px 3px; box-sizing: border-box; color: inherit; }
.anes-in:focus { outline: 1px solid #93c5fd; background: #fff; }
/* 超出参考范围：偏高红 / 偏低蓝 */
.anes-bad { background: #fee2e2 !important; }
.anes-bad .anes-in { color: #b91c1c; font-weight: 600; }
.anes-low { background: #dbeafe !important; }
.anes-low .anes-in { color: #1d4ed8; font-weight: 600; }

/* 标准显示（记录单版式；打印也用它） */
.anes-doc { border: 1px solid #94a3b8; border-radius: 6px; padding: 8px 10px; background: #fff; font-size: 12px; }
.anes-doc-title { text-align: center; font-size: 16px; font-weight: 700; letter-spacing: 2px; position: relative; margin-bottom: 6px; }
.anes-doc-no { position: absolute; right: 0; bottom: 0; font-size: 11px; font-weight: 400; letter-spacing: 0; }
.anes-hrow { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-bottom: 5px; }
.anes-hf { display: flex; align-items: center; gap: 4px; flex: 0 1 auto; min-width: 0; }
.anes-hf > label { font-size: 11px; color: #475569; white-space: nowrap; }
.anes-hf > .anes-h { border: 1px solid #cbd5e1; border-radius: 4px; padding: 1px 4px; height: 22px; font-size: 12px; width: 110px; background: #fff; }
.anes-asa { display: inline-flex; gap: 3px; }
.anes-chip { border: 1px solid #cbd5e1; background: #fff; border-radius: 12px; font-size: 11px; padding: 1px 8px; cursor: pointer; line-height: 1.7; color: var(--text); }
.anes-chip.on { background: #dcfce7; border-color: #16a34a; color: #166534; font-weight: 600; }
.anes-medrow { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.anes-medbox { flex: 1 1 320px; border: 1px solid #cbd5e1; border-radius: 6px; padding: 5px 7px; }
.anes-medtitle { font-weight: 600; font-size: 12px; margin-bottom: 3px; color: #334155; }
.anes-med { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.anes-med th, .anes-med td { border: 1px solid #e2e8f0; padding: 1px 3px; text-align: center; }
.anes-grid { width: 100%; border-collapse: collapse; font-size: 11.5px; margin-top: 6px; }
.anes-grid th, .anes-grid td { border: 1px solid #94a3b8; padding: 1px 4px; text-align: center; }
.anes-grid .anes-rh { background: #f1f5f9; width: 96px; text-align: left; font-weight: 600; }
.anes-events .anes-chip { margin-right: 3px; }
.anes-doc-foot { font-size: 10.5px; color: #64748b; margin-top: 6px; line-height: 1.6; }

/* 打印用（anesPrint 把 input/select 换成纯文本后的版式） */
.anes-print-doc { padding: 0; }
.anes-print-doc .anes-doc { border: 1px solid #000; border-radius: 0; padding: 3mm; font-size: 9.5pt; }
.anes-print-doc .anes-doc-title { font-size: 15pt; margin-bottom: 2mm; }
.anes-print-doc .anes-hf > label { font-size: 8.5pt; }
.anes-print-doc .anes-hrow { gap: 2mm 4mm; margin-bottom: 1.5mm; }
.anes-print-val { display: inline-block; min-width: 55px; border-bottom: 1px solid #000; padding: 0 2px; }
.anes-print-chip { font-size: 8pt; margin-right: 4px; }
.anes-print-chip.on { font-weight: 700; }
.anes-print-doc .anes-med th, .anes-print-doc .anes-med td { border: 1px solid #000; }
.anes-print-doc .anes-grid th, .anes-print-doc .anes-grid td { border: 1px solid #000; font-size: 8.5pt; }
.anes-print-doc .anes-bad { background: #fff !important; color: #c00; font-weight: 700; }
.anes-print-doc .anes-low { background: #fff !important; color: #00f; font-weight: 700; }
.anes-print-doc .anes-doc-foot { color: #333; font-size: 7.5pt; }

/* ================= 工具页（★ 2026-10-18） ================= */
.tool-top { flex: 1 1 55%; min-height: 0; overflow: auto; }
.tool-bottom { flex: 1 1 45%; min-height: 0; overflow: auto; }
.tool-fields { display: flex; flex-wrap: wrap; gap: 10px 14px; margin: 8px 0 12px; }
.tool-f { display: flex; align-items: center; gap: 6px; }
.tool-f > label { font-size: 12px; color: #475569; white-space: nowrap; }
.tool-f > .input { width: 128px; height: 28px; font-size: 13px; }
.tool-res { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tool-res-item { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: #f8fafc; }
.tr-label { font-size: 11.5px; color: #64748b; }
.tr-val { font-size: 22px; font-weight: 700; color: #0f766e; line-height: 1.35; }
.tr-unit { font-size: 12px; font-weight: 400; color: #475569; margin-left: 4px; }
.tool-formula { font-size: 11.5px; color: var(--text-muted); margin-top: 10px; line-height: 1.6; }
.tool-icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.tool-icon {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  padding: 12px 6px; border: 1px solid var(--border); border-radius: 10px; background: #fff; cursor: pointer;
}
.tool-icon:hover { border-color: #93c5fd; }
.tool-icon.active { border-color: #0f766e; background: #eef7f3; box-shadow: inset 0 0 0 1px #0f766e; }
.ti-ico { font-size: 24px; line-height: 1; }
.ti-name { font-size: 12px; color: var(--text); }
.tool-detail .dd-title { font-size: 14px; }

/* ===== 客户风险等级（高危红 / 异常天蓝 / 普通备注）===== */
.risk-row-high { background: #ffecec !important; }
.risk-row-high td, .risk-row-high td b, .risk-row-high td span { color: #c62828 !important; }
.risk-row-abn { background: #e8f6fe !important; }
.risk-row-abn td, .risk-row-abn td b, .risk-row-abn td span { color: #0e7cbd !important; }
.risk-badge {
  display: inline-block; margin-left: 5px; padding: 1px 7px; border-radius: 10px;
  font-size: 11px; font-weight: 700; line-height: 1.6; vertical-align: middle; white-space: nowrap;
}
.risk-badge-high { background: #c62828; color: #fff; }
.risk-badge-abn { background: #0ea5e9; color: #fff; }
.risk-badge-note { background: #e2e8f0; color: #475569; font-weight: 600; }
/* 寄养(住院)笼位：占用动物高危红框 / 异常蓝框 */
.cage-cell.risk-cell-high { border-color: #c62828 !important; box-shadow: 0 0 0 1px #c62828 inset; }
.cage-cell.risk-cell-abn { border-color: #0ea5e9 !important; box-shadow: 0 0 0 1px #0ea5e9 inset; }

/* ===== Word(.docx)/网页 结构化模板：打印按原文档纸张/页边距输出（表格/字号/对齐/图片保留） ===== */
@media print {
  .rx-print .word-page { box-shadow: none; margin: 0; background: #fff; box-sizing: border-box; }
  .rx-print .word-doc { font-family: "SimSun", "宋体", serif; line-height: 1.5; color: #000; }
  .rx-print .word-doc p.w-p { margin: 0 0 2px 0; }
  .rx-print .word-doc p.w-h { font-weight: bold; }
  .rx-print .word-doc p.w-h1 { font-size: 1.25em; text-align: center; margin: 6px 0; }
  .rx-print .word-doc p.w-h2 { font-size: 1.12em; margin: 5px 0; }
  .rx-print .word-doc p.w-h3 { font-size: 1.06em; margin: 4px 0; }
  .rx-print .word-doc table.w-tbl { border-collapse: collapse; margin: 3px 0; max-width: 100%; }
  .rx-print .word-doc table.w-tbl td { padding: 2px 4px; vertical-align: top; }
  .rx-print .word-doc table.w-bordered td { border: 1px solid #000; }
  .rx-print .word-doc table.w-plain td { border: none; }
  .rx-print .word-doc img { max-width: 100%; height: auto; }
  .rx-print .word-doc .w-tab { display: inline-block; min-width: 2em; }
}