/* main.css - 主样式（浅色主题） */
:root {
  --primary: #2f6fed;
  --primary-dark: #1d4fd6;
  --primary-light: #e8effd;
  --accent: #16a085;
  --danger: #e5484d;
  --warning: #f5a623;
  --bg: #f4f6fb;
  --bg-panel: #ffffff;
  --border: #e2e8f0;
  --text: #1f2937;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.12);
  --radius: 10px;
  --sidebar-width: 200px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.6;
  height: 100vh;
  overflow: hidden;
}

/* ============ 顶部标题栏 ============ */
.topbar {
  height: 52px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-shadow: var(--shadow);
  z-index: 10;
  position: relative;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 22px; }
.clinic-name { font-size: 16px; font-weight: 600; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.doctor-indicator {
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--primary-light);
  padding: 4px 12px;
  border-radius: 16px;
}

/* 右上角账号切换（下拉） */
.topbar-user {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 2px 10px 2px 2px;
  border-radius: 18px;
  border: 1px solid transparent;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}
.topbar-user:hover { border-color: var(--border); background: var(--primary-light); }
.topbar-user .caret { font-size: 10px; color: var(--text-muted); }
.dropdown-menu {
  position: absolute;
  top: 46px;
  right: 12px;
  min-width: 240px;
  max-width: 320px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 999;
  padding: 6px;
  max-height: 70vh;
  overflow-y: auto;
}
.dropdown-current {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
}
.dropdown-user-name { color: var(--text); }
.dropdown-role {
  font-size: 11px;
  color: var(--accent);
  background: #e6f7f2;
  padding: 1px 8px;
  border-radius: 10px;
  font-weight: 500;
  white-space: nowrap;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: background 0.12s;
  flex-wrap: wrap;
}
.dropdown-item:hover { background: var(--primary-light); }
.dropdown-item.active { color: var(--primary); font-weight: 600; }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: #fdecec; }
.dropdown-item.disabled { color: var(--text-muted); cursor: default; }
.dropdown-item.disabled:hover { background: transparent; }
.dropdown-doctor { color: var(--text-muted); font-size: 12px; }
.dropdown-check { margin-left: auto; color: var(--primary); }
.dropdown-divider { height: 1px; background: var(--border); margin: 5px 4px; }

/* ============ 登录 / 初始化全屏层 ============ */
.login-mask {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;   /* 兼容写法（inset 在旧浏览器不支持） */
  z-index: 2000;
  background: linear-gradient(160deg, #eef3fd 0%, #f4f6fb 55%, #eafaf4 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* ============ 启动/加载动画层（小狗狗跑动；账号系统 + 按权限预加载完成前显示，首屏渲染后隐藏） ============ */
.boot-screen {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 1500;                 /* 低于登录层(2000)/诊断条(3000)，高于业务内容 */
  background: linear-gradient(160deg, #eef3fd 0%, #f6f8fd 50%, #eafaf4 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: opacity .35s ease;
}
.boot-screen.hide { opacity: 0; pointer-events: none; }
.boot-box { text-align: center; width: 100%; max-width: 380px; }
.boot-dog { position: relative; width: 132px; height: 70px; margin: 0 auto 8px; }
.boot-dog .dog-emoji {
  font-size: 56px; line-height: 1; display: block;
  transform-origin: 50% 85%;
  animation: dogBounce .55s infinite ease-in-out;
}
.boot-dog .dog-legs { display: flex; gap: 7px; justify-content: center; margin-top: -6px; }
.boot-dog .dog-legs i {
  width: 5px; height: 17px; border-radius: 3px; background: #7a5b2e;
  transform-origin: 50% 0; animation: dogLeg .5s infinite ease-in-out;
}
.boot-dog .dog-legs i:nth-child(odd) { animation-delay: .25s; }
@keyframes dogLeg { 0%, 100% { transform: rotate(18deg); } 50% { transform: rotate(-18deg) translateY(-1px); } }
@keyframes dogBounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.boot-title { font-size: 17px; font-weight: 700; color: #1f2937; }
.boot-intro { font-size: 13px; color: #6b7a90; margin-top: 8px; line-height: 1.8; }
.boot-note { font-size: 11px; color: #a4b0c2; }
.boot-dots { display: flex; gap: 6px; justify-content: center; margin-top: 14px; }
.boot-dots i { width: 8px; height: 8px; border-radius: 50%; background: #2f6fed; animation: dotPulse 1.2s infinite ease-in-out; }
.boot-dots i:nth-child(2) { animation-delay: .2s; }
.boot-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes dotPulse { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1); } }
.boot-ver { font-size: 11px; color: #a4b0c2; margin-top: 10px; }

/* 页面诊断条：任何 JS 错误都会显示在这里（帮助定位问题） */
.diag-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 3000;
  background: #fff3cd;
  border-bottom: 1px solid #f0d48a;
  color: #7a5b00;
  font-size: 12px;
  line-height: 1.6;
  padding: 6px 14px;
  display: none;
}
.diag-bar.error { background: #fdecec; border-color: #f5c2c4; color: #c62828; }
.login-card {
  width: 380px;
  max-width: 100%;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 32px 32px 28px;
}
.login-logo { font-size: 40px; text-align: center; margin-bottom: 6px; }
.login-title { font-size: 20px; font-weight: 700; text-align: center; color: var(--text); }
.login-sub { font-size: 13px; color: var(--text-secondary); text-align: center; margin-top: 4px; margin-bottom: 18px; }
.login-tip {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--primary-light);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 14px;
  line-height: 1.7;
}
.login-error {
  font-size: 13px;
  color: var(--danger);
  background: #fdecec;
  border: 1px solid #f5c2c4;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 12px;
}
.login-field { margin-bottom: 14px; }
.login-field label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 5px;
}
.login-field input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.login-field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12); }
/* 免输账号：本机/本门店记住的登录账号（只显示密码框） */
.login-user {
  background: var(--primary-light);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
}
.login-user-main { font-size: 15px; font-weight: 700; color: var(--text); }
.login-user-sub { font-size: 12px; color: var(--text-secondary); margin-top: 3px; }
.login-user-sub a { color: var(--primary); text-decoration: none; }
.login-user-sub a:hover { text-decoration: underline; }
.login-remember {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.login-remember input { width: auto; margin: 0; }
.btn-block { width: 100%; }

/* ============ 布局 ============ */
.layout { display: flex; height: calc(100vh - 52px); }

/* ============ 侧边栏 ============ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
/* 导航栏宽度拖拽分隔条 */
.sidebar-resizer {
  flex: 0 0 5px;
  cursor: col-resize;
  background: transparent;
  transition: background 0.15s;
  touch-action: none;
}
.sidebar-resizer:hover,
.sidebar-resizer.dragging { background: var(--primary-light); }
.nav-list { list-style: none; flex: 1; overflow-y: auto; padding: 8px 0; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 14px;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
  border-left-color: var(--primary);
}
.nav-divider { height: 1px; background: var(--border); margin: 8px 14px; }
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); }

/* ============ 内容区 ============ */
.content { flex: 1; overflow-y: auto; padding: 20px; }

.page-title { font-size: 20px; font-weight: 700; margin-bottom: 16px; color: var(--text); }

/* ============ 卡片 ============ */
.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; color: var(--text); }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--accent); color: #fff; }
.btn-success:hover { background: #138a72; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c93a3e; }
.btn-outline { background: #fff; color: var(--text-secondary); border-color: var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============ 表单 ============ */
.input, .select, .textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.1);
}
.textarea { resize: vertical; min-height: 60px; }
.form-group { margin-bottom: 12px; }
.form-label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; font-weight: 500; }
.form-label .required { color: var(--danger); }

/* ============ 表格 ============ */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  padding: 4px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.25;
}
.table th { color: var(--text-secondary); font-weight: 600; background: #f8fafc; position: relative; }
.table tr:hover td { background: #f8fafc; }

/* 全局更紧凑的表格（进货记录等）：行高尽量小、单倍行距 */
.table.sup-order-table th, .table.sup-order-table td {
  padding: 1px 4px;
  font-size: 12px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.table.sup-order-table { border-collapse: collapse; }
.table.sup-order-table thead th {
  cursor: col-resize;
  user-select: none;
  border-right: 2px solid transparent;
}
.table.sup-order-table thead th.sup-resize:hover { background: #eef2ff; }
.table.sup-order-table td.sup-edit { cursor: cell; }
.table.sup-order-table td.sup-edit:hover { background: #f0f9ff; }

/* 选品表格：紧凑（每产品一行）+ 表头右缘拖拽调列宽 */
.table.sup-pick-table { border-collapse: collapse; }
.table.sup-pick-table th, .table.sup-pick-table td {
  padding: 1px 5px !important;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.table.sup-pick-table thead th { cursor: col-resize; user-select: none; border-right: 2px solid transparent; }
.table.sup-pick-table thead th.sup-resize:hover { background: #eef2ff; }
.sup-pick-row.pending td { background: #fefce8; }
/* 已选入（在待补货目录/销售列表）：浅绿标识，避免重复选入 */
.sup-pick-row.state-active td { background: #f0fdf4; }
.sup-pick-row.state-active td .sup-pick-name { color: #15803d; }
/* 候选（未选入）：默认白底 */
.sup-pick-row.state-removed td { background: #ffffff; }
/* 已淘汰：置灰排在末尾，不可再加入待补货/销售（不彻底删除） */
.sup-pick-row.state-deleted td { color: #9ca3af; background: #f1f5f9; }
.sup-pick-row.state-deleted td .sup-pick-name { color: #9ca3af; }
.sup-pick-row.state-deleted .sup-pick-cb { opacity: .45; cursor: not-allowed; }
/* 编辑态勾选高亮 */
.sup-pick-row.sup-pick-sel td { background: #eff6ff !important; }
.sup-pick-cb { margin: 0; vertical-align: middle; cursor: pointer; }

/* 药品/耗材库表格列宽手动调整 */
.lib-table--fixed { table-layout: fixed; }
.lib-table th .col-resizer {
  position: absolute; right: 0; top: 0; height: 100%; width: 7px;
  cursor: col-resize; user-select: none; z-index: 2;
}
.lib-table th .col-resizer:hover { background: var(--primary, #3b82f6); opacity: .35; }
.lib-table--fixed th, .lib-table--fixed td { overflow: hidden; }

/* 药品/耗材库表格：可排序表头 + 上下箭头 */
.lib-table th.lib-sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.lib-table th.lib-sortable:hover { background: var(--bg-hover, #f1f5f9); }
.lib-sort-arrow { display: inline-block; margin-left: 2px; font-size: 11px; color: #94a3b8; vertical-align: middle; }
.lib-sort-arrow.active { color: var(--primary, #3b82f6); font-weight: 700; }

/* 处方/检查页表格紧凑化：缩小行距与列宽，药品检索表密度尽可能紧凑 */
.pet-table th, .pet-table td { padding: 2px 6px; line-height: 1.12; font-size: 12px; }
.pet-table tr { height: 22px; }
.pet-table .btn-sm { padding: 2px 6px; font-size: 12px; }
.pet-table .tag { padding: 1px 6px; font-size: 11px; }
/* 挂号时勾选「是否购买保险＝是」的就诊：候诊 / 住院 / 就诊记录 名单整行加粗，与周围明显区分 */
.pet-row.ins-row, .pet-row.ins-row td, .pet-row.ins-row td b, .pet-row.ins-row .tag { font-weight: 700; }
.drug-picker-table { font-size: 12px; }
.drug-picker-table th, .drug-picker-table td { padding: 2px 5px; line-height: 1.12; white-space: nowrap; }
.drug-list { max-height: 380px; overflow-y: auto; }

/* ============ 标签 ============ */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}
.tag-blue { background: #e0ecff; color: #1d4fd6; }
.tag-green { background: #d8f3ec; color: #138a72; }
.tag-red { background: #fde2e2; color: #c93a3e; }
.tag-orange { background: #fdeed6; color: #c77a08; }
.tag-gray { background: #eef1f5; color: #64748b; }

/* ============ 编辑模式切换按钮 / 挂号预约确认信息 ============ */
.btn-warning { background: #f59e0b; color: #fff; border-color: #f59e0b; }
.btn-warning:hover { background: #d98706; }
.reg-confirm-info {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px 16px;
  background: var(--bg, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 13px;
}
.reg-confirm-info > div { display: flex; gap: 6px; }
.rc-label { color: var(--text-muted, #94a3b8); min-width: 56px; }
.id-cell .id-mask { font-size: 14px; user-select: none; }
.id-cell .id-value { font-variant-numeric: tabular-nums; }
.tag-gray { background: #eef1f5; color: #64748b; }

/* ============ toast ============ */
#toast-container {
  position: fixed;
  top: 64px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 10px 18px;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(-8px);
  transition: all 0.3s;
}
.toast-show { opacity: 1; transform: translateY(0); }
.toast-info { background: var(--primary); }
.toast-success { background: var(--accent); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  background: #fff;
  border-radius: 12px;
  width: 520px;
  max-width: 92vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-muted); line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; overflow-y: auto; }

/* 表单分节标题 */
.form-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin: 14px 0 10px;
  padding-left: 8px;
  border-left: 3px solid var(--primary);
}
.form-section-title:first-child { margin-top: 0; }

/* 供货商行 */
.supplier-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.supplier-row .btn { flex-shrink: 0; }

/* 药品库存表 */
.drug-table th { white-space: nowrap; }
.drug-table td { vertical-align: top; }

/* 说明书链接 */
.manual-link { color: var(--primary); text-decoration: none; font-size: 13px; }
.manual-link:hover { text-decoration: underline; }

/* ============ 个人中心 ============ */
/* 机构信息一行 */
.clinic-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.clinic-bar-name { font-size: 16px; font-weight: 700; }
.clinic-bar-meta { font-size: 13px; color: var(--text-secondary); flex: 1; }

/* 个人中心两栏布局（右栏宽度可拖拽） */
.profile-layout { display: grid; grid-template-columns: 1fr 8px 380px; align-items: start; }
.profile-divider {
  cursor: col-resize;
  align-self: stretch;
  border-radius: 4px;
  background: transparent;
  position: relative;
}
.profile-divider:hover { background: var(--primary-light); }
.profile-divider::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
  border-radius: 1px;
}
@media (max-width: 1100px) { .profile-layout { grid-template-columns: 1fr; } .profile-layout .profile-divider { display: none; } }

/* 保险资料三列布局：等比例收缩（不折叠右侧名单，三列始终完整显示） */
.ins-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 8px minmax(200px, 0.36fr);
  align-items: start;
  min-width: 0;
  width: 100%;
}
.ins-layout > .profile-left,
.ins-layout > .profile-divider,
.ins-layout > .profile-right { min-width: 0; }
.ins-layout .profile-left > .card,
.ins-layout .profile-right > .card { min-width: 0; }
.ins-layout .profile-left { overflow-x: auto; }
/* 右侧名单卡片：纵向弹性；列表区自适应收缩滚动，底部「激活诊疗」始终同屏可见（无需下滑） */
.ins-right-card { display: flex; flex-direction: column; max-height: calc(100vh - 180px); }
.ins-right-card .staff-header,
.ins-right-card .pet-tabs { flex: 0 0 auto; }
.ins-list-area {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  max-height: 372px;   /* 约15行（行高约24px）；窗口矮时随 flex 进一步收缩 */
}
.ins-list-footer { flex: 0 0 auto; }

/* 右侧动物/就诊列表（诊疗·待诊/住院、驱虫疫苗·待诊/住院、保险·待诊/住院/最近就诊）：
   统一紧凑单行、缩小字号与行距；固定高度超出部分上下滚动 */
#ins-list .ins-item,
#ins-list .ins-item.ins-line { padding: 2px 10px; font-size: 11px; line-height: 1.35; }
#ins-list .ins-item { border-bottom: 1px solid var(--border); }
#exam-pet-list .pet-table th,
#exam-pet-list .pet-table td,
#im-pet-list .pet-table th,
#im-pet-list .pet-table td { padding: 1px 5px; font-size: 11px; line-height: 1.25; white-space: nowrap; }
#exam-pet-list,
#im-pet-list { overflow-x: auto; }
#exam-pet-list,
#im-pet-list,
#ins-list { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

/* 员工管理标题行 */
.staff-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.staff-title { font-size: 15px; font-weight: 700; }

/* 员工表格 */
.staff-table th { white-space: nowrap; }
.staff-table td { vertical-align: middle; }

/* 头像 */
.staff-avatar { display: inline-block; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.staff-avatar-fallback {
  background: var(--primary-light);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  border-radius: 50%;
}

/* 头像上传 */
.avatar-upload-row { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }

/* 排班日历 */
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.cal-title { font-size: 15px; font-weight: 700; }
.cal-control {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cal-current { font-size: 13px; }
.shift-btns { display: flex; gap: 6px; }
.week-repeat { font-size: 13px; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; cursor: pointer; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-grid-head { border-bottom: 1px solid var(--border); }
.cal-cell-head { text-align: center; font-size: 12px; color: var(--text-muted); padding: 6px 0; }
.cal-cell {
  min-height: 84px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 4px;
  font-size: 11px;
  cursor: pointer;
  overflow: hidden;
  transition: background 0.1s;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell:hover { background: var(--primary-light); }
.cal-cell-empty { cursor: default; }
.cal-cell-empty:hover { background: transparent; }
.cal-today { background: #fff8e6; }
.cal-day { font-weight: 600; font-size: 12px; margin-bottom: 2px; }
.cal-shift-row { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.5; }
.cal-shift-tag { font-size: 10px; padding: 0 3px; border-radius: 2px; }

/* ============ 预约页 ============ */
.appt-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.appt-field { display: flex; flex-direction: column; gap: 4px; }
.appt-field label { font-size: 12px; color: var(--text-muted); }
.appt-field .input, .appt-field .select { width: 130px; }
.appt-match {
  flex-basis: 100%;
  background: var(--primary-light);
  border-radius: 8px;
  padding: 8px;
  max-height: 160px;
  overflow-y: auto;
}
.appt-match-title { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.appt-match-item { padding: 6px 10px; cursor: pointer; border-radius: 4px; font-size: 13px; }
.appt-match-item:hover { background: #fff; }

.appt-config { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.appt-config-title { font-size: 16px; font-weight: 700; margin-right: 6px; }
.appt-config label { font-size: 12px; color: var(--text-secondary); display: flex; align-items: center; gap: 4px; }
.appt-config-display { font-size: 13px; color: var(--text-secondary); background: var(--bg); padding: 4px 12px; border-radius: 6px; }

/* 时间轴表格 */
.appt-scroll-wrap { overflow-x: auto; overflow-y: auto; max-height: 520px; }
.appt-table { min-width: max-content; }
.appt-row {
  display: grid;
  border-bottom: 1px solid var(--border);
}
.appt-head-row { position: sticky; top: 0; z-index: 2; background: #f8fafc; }
.appt-head-time { position: sticky; left: 0; z-index: 3; background: #f8fafc; }
.appt-head-day { text-align: center; padding: 6px 0; border-left: 1px solid var(--border); }
.appt-head-num { font-weight: 700; font-size: 13px; }
.appt-head-week { font-size: 11px; color: var(--text-muted); }
.appt-today { background: #fff8e6; }
.appt-time {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fff;
  padding: 6px 8px;
  font-size: 12px;
  color: var(--text-secondary);
  border-right: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}
.appt-cell {
  border-left: 1px solid var(--border);
  padding: 2px;
  min-height: 34px;
  font-size: 11px;
}
.appt-item {
  background: #e0ecff;
  color: #1d4fd6;
  border-radius: 4px;
  padding: 2px 5px;
  margin-bottom: 2px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
}
.appt-item:hover { background: #c7dbff; }
.appt-item.appt-selected { outline: 2px solid var(--primary); }
.appt-item.appt-done { background: #d8f3ec; color: #138a72; }
.appt-item.appt-missed { background: #fde2e2; color: #c93a3e; text-decoration: line-through; }

.appt-slider-wrap { padding: 10px 14px; border-top: 1px solid var(--border); display: flex; }
.appt-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-top: 14px;
  box-shadow: var(--shadow);
}

/* 宠物检索栏 */
.pet-search-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.pet-search-bar .input { width: 160px; }
.pet-dead { opacity: 0.55; }
.pet-dead td { color: var(--text-muted); }

/* ============ 寄养住院笼位 ============ */
.cage-box {
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--bg-panel);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.cage-no {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  padding: 6px 12px;
  text-align: center;
}
.cage-no-edit { cursor: text; }
.cage-no-edit:hover { outline: 2px dashed #fff; outline-offset: -2px; }
.cage-body { display: flex; gap: 10px; padding: 12px; }
.cage-cat {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  flex-shrink: 0;
  border: 2px dashed var(--primary);
}
.cage-cat:hover { background: #c7dbff; }
.cage-info { flex: 1; min-width: 0; font-size: 12px; }
.cage-petname { font-weight: 700; font-size: 14px; margin-bottom: 2px; }
.cage-line { color: var(--text-secondary); line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cage-release { flex-shrink: 0; align-self: flex-start; }
.cage-pick-item { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--border); font-size: 13px; }
.cage-pick-item:hover { background: var(--primary-light); }

/* 笼架分组网格（表格化笼位） */
.cage-group { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--bg-panel); }
.cage-group-title { padding: 8px 14px; background: #f8fafc; font-weight: 600; font-size: 14px; border-bottom: 1px solid var(--border); }
.cage-grid-inner { display: grid; gap: 8px; padding: 10px; }
.cage-cell {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  min-height: 118px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: #fff;
  cursor: pointer;
}
.cage-cell.selected { outline: 2px solid #16a34a; outline-offset: -2px; }

/* ============ 寄养(住院) 两栏：左=笼子布局，右=该动物护理记录 ============ */
.board-layout { display: grid; grid-template-columns: minmax(0, 1fr) 8px 380px; gap: 0; align-items: start; }
.board-left { min-width: 0; }
.board-right {
  min-width: 0;
  position: sticky;
  top: 8px;
  max-height: calc(100vh - 190px);
  overflow-y: auto;
}
.board-cage-no { border-radius: 6px; padding: 2px 10px; font-size: 14px; display: inline-block; }
.board-nlog-item { border-bottom: 1px dashed var(--border); padding: 6px 0; }
.board-nlog-item:last-child { border-bottom: none; }
.board-nlog-item .bnl-head { display: flex; align-items: center; gap: 8px; }
.board-nlog-item .bnl-date { font-weight: 600; font-size: 12px; color: #0e7490; }
.board-nlog-item .bnl-body { font-size: 12px; color: var(--text-secondary); line-height: 1.6; margin-top: 2px; white-space: normal; word-break: break-word; }

.cage-cell.occupied { background: #f0f7ff; border-color: var(--primary); }
.cage-icon { font-size: 28px; cursor: pointer; user-select: none; line-height: 1; }
.cage-icon:hover { transform: scale(1.12); }
.cage-cell-info { font-size: 12px; text-align: center; width: 100%; color: var(--text); }
.cage-cell-info .cage-line { font-size: 11px; color: var(--text-secondary); line-height: 1.4; }
.cage-cell-info.empty { color: var(--text-muted); padding: 6px 0; }
.cage-line-edit { cursor: text; border-radius: 3px; padding: 0 2px; }
.cage-line-edit:hover { background: var(--primary-light); color: var(--primary); outline: 1px dashed var(--primary); }
.cage-line-edit input { width: 100%; font-size: 11px; padding: 1px 3px; }
.cage-cell-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.cage-cell-actions .btn { padding: 2px 10px; font-size: 12px; }

/* ============ 病历 ============ */
.medical-table th { white-space: nowrap; }
.medical-table td { font-size: 12px; }

/* 单条病历弹窗加宽 */
.modal-wide { width: 860px; max-width: 94vw; }

/* 单条病历 2列12行表格 */
.mr-table { width: 100%; border-collapse: collapse; }
.mr-table th, .mr-table td { border: 1px solid var(--border); padding: 8px 10px; font-size: 13px; vertical-align: top; text-align: left; }
.mr-table .mr-label { width: 1%; background: #f8fafc; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.mr-table textarea.mr-edit { width: 100%; box-sizing: border-box; min-height: 64px; border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; font-size: 13px; font-family: inherit; resize: vertical; }
.mr-table textarea.mr-edit:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,111,237,.1); }
.mr-item-line { padding: 2px 0; }
/* 病历·检查明细：只写名称+时间，多列显示（例：生化10项(9.12)）；列宽自适应 2~4 列 */
.mr-item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 2px 14px; }
.mr-item-grid .mr-item { padding: 2px 0; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
@media print { .mr-item-grid { grid-template-columns: repeat(3, 1fr); } }
.mr-editable-row { cursor: pointer; }
.mr-editable-row:hover td { background: #f0f7ff; }
.mr-treat-line { padding: 2px 0; cursor: pointer; border-radius: 4px; }
.mr-treat-line:hover { background: #f0f7ff; }
.mr-tag { display: inline-block; background: #e0ecff; color: #1d4fd6; border-radius: 10px; padding: 1px 8px; font-size: 12px; margin: 1px 3px 1px 0; }
.mr-info-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px 14px; font-size: 12.5px; }
.mr-info-item { display: flex; align-items: baseline; gap: 4px; }
.mr-info-item .k { color: var(--text-muted); }
.mr-special-k { color: var(--text-muted); }
.mr-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.mr-visit-row { cursor: pointer; }
.mr-visit-row:hover td { background: var(--primary-light); }

/* ============ 媒体附件（挂号病历附件 / 护理记录附件） ============ */
.media-strip img { transition: transform .12s; }
.media-strip img:hover { transform: scale(1.06); }
[data-media-icon] { transition: background .12s, border-color .12s; }
[data-media-icon]:hover { background: var(--primary-light); border-color: var(--primary); }
@media print {
  .media-strip { display: none !important; }   /* 打印病历不带附件缩略图 */
  .mr-table th, .mr-table td { border-color: #000; }
}

/* 隐藏所有页面标题，增大工作区域 */
#content .page-title { display: none; }

/* 病历列表折叠三角 */
.mr-caret-cell { text-align: center; cursor: pointer; width: 32px; user-select: none; }
.mr-caret { font-size: 12px; color: var(--text-muted); transition: transform .15s; }
.mr-caret.open { color: var(--primary); }
.mr-detail-row td { background: #fbfdff; padding: 10px 12px !important; }
.mr-detail-box { max-height: 420px; overflow-y: auto; }
.mr-detail-box .mr-table { font-size: 12px; }
.mr-detail-box .mr-table th, .mr-detail-box .mr-table td { padding: 5px 8px; }

/* 处方工作区标题行：左侧标题 + 右侧开具时间 */
.rx-section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }

/* 诊疗页工作区标题行：左侧「工作区（检查/处置/处方）」+ 右侧内联宠物主人等基本信息 */
.rx-head-left { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; min-width: 0; }
.rx-animal-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 14px; font-size: 12px; color: var(--text-secondary); }
.rx-animal-inline .al-item { display: inline-flex; align-items: baseline; }
.rx-animal-inline .al-label { font-size: 11px; color: var(--text-muted); }
.rx-animal-inline b { color: var(--text); }
.rx-animal-inline .al-vital-item { align-items: center; }
.rx-animal-inline .animal-vital { vertical-align: middle; }

/* 检查/处置/处方工作区紧凑：缩小区块内边距/标题间距，一屏尽量多显示内容 */
.rx-main .rx-section { padding: 10px 12px; }
.rx-main .rx-section-head { margin-bottom: 6px; }
.rx-main .rx-section-title { font-size: 13px; margin-bottom: 4px; }
#rx-items { margin-top: 4px; }
#rx-preview .rx-diag-row { margin-bottom: 2px; }

/* 供货商页：当前模式徽标（补货 / 选品 / 补货记录） */
.sup-mode-badge { color: #fff; font-size: 11px; line-height: 1; padding: 4px 9px; border-radius: 10px; font-weight: 600; white-space: nowrap; }

/* 处方药品表格紧凑化 */
.rx-item-table th, .rx-item-table td { padding: 3px 6px; font-size: 12px; }
.rx-item-table input { height: 24px; padding: 1px 4px; font-size: 12px; }
/* 诊疗工作区更紧凑：缩小字号/行距、行尽量不换行（区块内横向滚动，不折行、不整页堆叠） */
.rx-main .rx-section { padding: 6px 10px; }
.rx-main .rx-section-title { font-size: 12px; margin-bottom: 3px; }
.rx-main .rx-item-table th,
.rx-main .rx-item-table td { padding: 2px 5px; font-size: 11.5px; line-height: 1.3; white-space: nowrap; }
#exam-items, #rx-items { overflow-x: auto; }

/* ★ 2026-09-27 用户口径：检查项目 / 处置项目 / 处方 —— **每个项目只占一行、紧凑显示**；
   宽度不够时由 js fitPickerTables 自动缩字号（不折行、不被右侧详情栏遮住）。
   这里只负责“不折行 + 行不留多余高度”，具体字号由 JS 按实测宽度算。 */
.rx-main .rx-item-table td,
.rx-main .rx-item-table th { vertical-align: middle; }
.rx-main .rx-item-table tbody tr { height: 26px; }
.rx-main .rx-item-table td > div { margin-top: 0 !important; }
.rx-main .rx-item-table td .btn { padding: 1px 6px; line-height: 1.2; }
.rx-main .rx-item-table .exam-inline-name,
.rx-main .rx-item-table .exam-inline-price { max-width: none; }
.drug-picker-table tbody tr { height: 24px; }

/* 本院药品目录：与药品库不一致的单元格统一浅橙底纹 */
.lib-cat-diff { background: #fff3e0 !important; }
.lib-cat-diff-row { background: #fffaf0; }
/* 本院药品目录只读态：锁定外观 */
.lib-cat-table .cat-edit:disabled {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
  opacity: 1;           /* 覆盖浏览器默认半透明，保证灰底可读 */
}

/* 药品库（主数据库）表格：紧凑排版，整表放入中间区无需横向拖动 */
.lib-master-table { table-layout: fixed; font-size: 12px; }
.lib-master-table thead th { font-size: 12px; white-space: nowrap; overflow: hidden; padding: 3px 5px; }
.lib-master-table tbody td { padding: 2px 5px; overflow: hidden; line-height: 1.3; vertical-align: middle; }
.lib-master-table tbody tr:hover td { background: var(--primary-light); }
.lib-master-table td.lib-master-name { white-space: normal; word-break: break-word; }
.lib-master-table td.lib-master-dose { white-space: nowrap; text-align: center; font-variant-numeric: tabular-nums; }
.lib-master-table td.lib-master-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-secondary); }
.lib-master-table td.lib-master-ops { white-space: nowrap; }
.lib-master-table .btn-sm { padding: 1px 6px; font-size: 11px; }
.lib-master-table .tag { font-size: 10px; padding: 1px 4px; }

/* 医疗文书（统一版式文书） */
.meddoc-body { line-height: 1.9; font-size: 14px; white-space: pre-wrap; }
.meddoc-print-body { white-space: pre-wrap; line-height: 1.9; font-size: 14px; padding: 0 8px; }
.meddoc-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }

/* 文书按钮列表（可自定义增减） */
.meddoc-btns { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.meddoc-btns .md-btn { border: 1px solid var(--border); background: #fff; color: var(--text-secondary); border-radius: 6px; padding: 4px 12px; font-size: 13px; cursor: pointer; }
.meddoc-btns .md-btn:hover { border-color: var(--primary); color: var(--primary); }
.meddoc-btns .md-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* 统一版式：页眉 / 动物信息 / 手术+麻醉 / 正文 */
.df-wrap { font-size: 13px; }
.df-header { text-align: center; font-size: 16px; font-weight: 700; padding: 6px 0 10px; border-bottom: 2px solid #999; margin-bottom: 10px; letter-spacing: 1px; }
.df-info { border: 1px solid #999; padding: 8px 10px; margin-bottom: 8px; text-align: center; }
/* ★ 2026-09-26：模板类文书（Word/PDF）也保留「基础信息框 + 手术/麻醉录入框」——
   基础信息是**只读展示**（自动取当前就诊动物，避免“改了不打印”的误解） */
.df-info-ro { background: #f8fafc; color: #334155; }
.df-info-ro::after { content: "（自动生成·只读）"; font-size: 11px; color: #94a3b8; margin-left: 6px; }
.df-info-note { font-size: 11px; color: var(--text-muted); margin: -4px 0 8px; line-height: 1.6; }
.df-row2 { display: flex; border: 1px solid #999; margin-bottom: 8px; }
.df-row2 .df-cell { flex: 1; padding: 8px 10px; }
.df-row2 .df-cell + .df-cell { border-left: 1px solid #999; }
.df-field-k { font-weight: 600; }
.df-an-wrap { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.df-fmtbar { display: flex; align-items: center; gap: 6px; margin: 8px 0; flex-wrap: wrap; }
.df-fmtbar button { min-width: 30px; padding: 2px 6px; font-weight: 700; }
.df-paras { border: 1px solid #999; padding: 6px 10px; }
.df-para { min-height: 26px; outline: none; padding: 4px 0; border-bottom: 1px dashed #e5e7eb; }
.df-para:last-child { border-bottom: none; }
.df-para:focus { outline: 1px dashed var(--primary); outline-offset: -1px; }
.df-para:empty::before { content: attr(data-ph); color: #b0b7c3; }
.df-edit { outline: none; }
.df-edit:focus { outline: 1px dashed var(--primary); outline-offset: -1px; }
.df-edit:empty::before { content: attr(data-ph); color: #b0b7c3; }
.df-para-ops { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.op-hint { font-size: 12px; color: #b0b7c3; margin-left: 4px; }
/* 打印版（页眉由 rx-print .header 统一输出） */
.df-print-info { border: 1px solid #000; padding: 8px 10px; margin-bottom: 8px; text-align: center; }
.df-print-row2 { border: 1px solid #000; padding: 8px 10px; margin-bottom: 8px; }
.df-print-body { line-height: 1.9; font-size: 14px; padding: 6px 4px; }
.df-print-para { min-height: 22px; margin-bottom: 6px; }
/* 上传模板提示条 + 打印预览（占位符已填基本信息的只读预览） */
.df-tplbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; background: #f0fdf4; border: 1px solid #86efac; color: #166534; border-radius: 6px; padding: 6px 10px; margin-bottom: 8px; }
.df-preview-wrap { margin-top: 12px; border: 1px dashed var(--border); border-radius: 8px; padding: 8px 10px; background: #fafbfc; }
.df-preview-title { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.df-preview { background: #fff; border: 1px solid #e5e7eb; border-radius: 6px; padding: 12px 14px; font-size: 13px; line-height: 1.9; max-height: 320px; overflow-y: auto; }
.df-preview .df-print-info, .df-preview .df-print-row2 { border-color: #cbd5e1; }

/* ============ Word(.docx)/网页 结构化模板：像 Word 的 A4 版面（正文可编辑） ============ */
.word-wrap { background: #eef2f7; border: 1px solid var(--border); border-radius: 6px; padding: 8px; overflow: auto; max-height: 460px; }
.word-page { background: #fff; margin: 0 auto; box-shadow: 0 1px 5px rgba(0,0,0,.15); box-sizing: border-box; }
.word-doc { font-family: "SimSun", "宋体", serif; line-height: 1.5; color: #000; }
.word-doc p.w-p { margin: 0 0 2px 0; }
.word-doc p.w-h { font-weight: bold; }
.word-doc p.w-h1 { font-size: 1.25em; text-align: center; margin: 6px 0; }
.word-doc p.w-h2 { font-size: 1.12em; margin: 5px 0; }
.word-doc p.w-h3 { font-size: 1.06em; margin: 4px 0; }
.word-doc table.w-tbl { border-collapse: collapse; margin: 3px 0; max-width: 100%; }
.word-doc table.w-tbl td { padding: 2px 4px; vertical-align: top; }
.word-doc table.w-bordered td { border: 1px solid #000; }
.word-doc table.w-plain td { border: none; }
.word-doc img { max-width: 100%; height: auto; }
.word-doc .w-tab { display: inline-block; min-width: 2em; }
.word-doc [contenteditable="true"]:focus, .word-doc:focus { outline: 1px dashed #93c5fd; outline-offset: 3px; }

/* ============ PDF 底图模板（kind='pdf'）：原稿整页 + 按坐标覆盖填充值 ============ */
.df-tplbar-pdf { background: #eff6ff; border-color: #93c5fd; color: #1e40af; }
.pdf-page { position: relative; overflow: hidden; background: #fff; margin: 0 auto; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.pdf-page + .pdf-page { margin-top: 10px; }
.pdf-page > img { display: block; width: 100%; height: 100%; }
.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;
}
.df-preview-pdf { padding: 8px; max-height: 460px; overflow: auto; background: #eef2f7; }
.df-preview-pdf .pdf-page { box-shadow: 0 1px 6px rgba(0,0,0,.18); }

/* ============ 预设签字 / 医院盖章（用户口径 2026-09-25） ============
   模板里 {医生签字}{医院盖章} 或「医生签字：____」都贴这里的图片；透明底 PNG 直接叠在文字上 */
.doc-sign-img { display: inline-block; vertical-align: middle; height: auto; max-width: 100%; }
.doc-sign-sign { margin-left: 2px; }
.doc-sign-seal { margin-left: 2px; }
.doc-sign-blank { letter-spacing: 1px; }
.pdf-fld-img { padding: 0; background: transparent; align-items: center; justify-content: center; }
.pdf-fld-img > img { display: block; }

/* PDF 模板上传后的复核窗 */
.pdfr-wrap { display: flex; flex-direction: column; gap: 8px; }
.pdfr-hint { font-size: 12px; color: var(--text-muted); line-height: 1.7; background: #f8fafc; border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; }
.pdfr-hint code { background: #eef2ff; color: #3730a3; padding: 0 3px; border-radius: 3px; }
/* ★ 2026-09-25：① 选内容（调色板）→ ② 在图上点位置 —— 扫描件/图片 PDF 只能这样标填充区 */
.pdfr-pal { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; background: #f8fafc; border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; }
.pdfr-pal-t { font-size: 12px; color: #334155; font-weight: 600; }
.pdfr-kbtn { font-size: 12px; padding: 2px 8px; border: 1px solid #cbd5e1; background: #fff; border-radius: 12px; cursor: pointer; color: #334155; }
.pdfr-kbtn:hover { border-color: #2f6fed; color: #2f6fed; }
.pdfr-kbtn.on { background: #2f6fed; border-color: #2f6fed; color: #fff; font-weight: 600; }
.pdfr-pal-tip { flex: 1 1 100%; font-size: 11.5px; color: #64748b; line-height: 1.6; }
.pdfr-box { cursor: move; }
.pdfr-box-del { position: absolute; right: -1px; top: -1px; width: 15px; height: 15px; padding: 0; border: none; border-radius: 3px; background: #ef4444; color: #fff; font-size: 10px; line-height: 15px; cursor: pointer; }
.pdfr-cols { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr); gap: 10px; }
.pdfr-view { max-height: 66vh; overflow: auto; background: #eef2f7; border: 1px solid var(--border); border-radius: 8px; padding: 10px; }
.pdfr-page { position: relative; background: #fff; margin: 0 auto 10px; box-shadow: 0 1px 5px rgba(0,0,0,.15); cursor: crosshair; }
.pdfr-page > img { display: block; width: 100%; }
.pdfr-layer { position: absolute; inset: 0; }
.pdfr-tag { position: absolute; right: 4px; bottom: 4px; font-size: 11px; color: #64748b; background: rgba(255,255,255,.85); border-radius: 3px; padding: 0 4px; pointer-events: none; }
.pdfr-box { position: absolute; border: 1px solid #ef4444; background: rgba(239,68,68,.16); box-sizing: border-box; }
.pdfr-box.pdfr-wys { background: #fff; border-style: dashed; }
.pdfr-val { position: absolute; left: 1px; right: 1px; bottom: 0; color: #000; overflow: hidden; white-space: nowrap;
  font-family: "SimSun", "宋体", serif; line-height: 1.05; pointer-events: none; }
.pdfr-box span { position: absolute; left: 0; top: -15px; font-size: 10px; color: #b91c1c; background: #fff; padding: 0 2px; white-space: nowrap; max-width: 160px; overflow: hidden; }
.pdfr-box-blank { border-color: #2563eb; background: rgba(37,99,235,.16); }
.pdfr-box-blank span { color: #1d4ed8; }
.pdfr-box.pdfr-hl { border-color: #16a34a; background: rgba(22,163,74,.25); }
/* ★ 2026-09-26：箭头调节 —— 选中的框（蓝虚线=实际保存的矩形）+ 箭头面板 + 局部放大窗 */
.pdfr-box.pdfr-box-sel { border-color: #2f6fed; background: rgba(47,111,237,.18); }
.pdfr-selbox { position: absolute; border: 2px dashed #2f6fed; background: rgba(47,111,237,.07); box-sizing: border-box; pointer-events: none; z-index: 3; }
.pdfr-ops { background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.pdfr-ops-head { display: flex; align-items: center; gap: 8px; font-size: 12px; flex-wrap: wrap; }
.pdfr-ops-t { font-weight: 700; color: #334155; }
.pdfr-ops-sel { color: #1d4ed8; background: #eef2ff; border-radius: 10px; padding: 1px 8px; font-size: 11.5px; }
.pdfr-ops-head #pdfr-mag-open { margin-left: auto; }
.pdfr-ops-grid { display: flex; align-items: center; gap: 12px; margin-top: 6px; flex-wrap: wrap; }
.pdfr-pad { display: grid; grid-template-columns: repeat(3, 30px); grid-auto-rows: 26px; gap: 3px; }
.pdfr-pad-sp { display: block; }
.pdfr-arw { border: 1px solid #cbd5e1; background: #fff; border-radius: 5px; cursor: pointer; color: #334155; font-size: 12px; padding: 0; line-height: 1; height: 26px; }
.pdfr-arw:hover { border-color: #2f6fed; color: #2f6fed; background: #eef4ff; }
.pdfr-arw:active { background: #2f6fed; color: #fff; }
.pdfr-arw-sm { width: 30px; height: 24px; }
.pdfr-pad-mid { display: flex; align-items: center; justify-content: center; font-size: 10.5px; color: #64748b; background: #f1f5f9; border-radius: 5px; height: 26px; }
.pdfr-rs { display: flex; flex-direction: column; gap: 3px; }
.pdfr-rs-row { display: flex; align-items: center; gap: 4px; font-size: 12px; color: #334155; }
.pdfr-rs-k { width: 26px; color: #64748b; }
.pdfr-rs-out { font-size: 11px; color: #64748b; min-width: 46px; }
.pdfr-ops-num { font-size: 11.5px; color: #334155; margin-top: 6px; line-height: 1.6; }
.pdfr-table tr.pdfr-row-sel td { background: #eef2ff; }
/* 局部放大微调窗（挂在弹窗里、固定定位，可拖标题栏） */
.pdfr-mag { position: fixed; right: 18px; bottom: 18px; width: 372px; background: #fff; border: 1px solid #cbd5e1;
  border-radius: 10px; box-shadow: 0 12px 32px rgba(15,23,42,.28); z-index: 10050; padding: 8px 10px 10px; }
.pdfr-mag-head { display: flex; align-items: center; gap: 6px; cursor: move; font-size: 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.pdfr-mag-h { font-weight: 700; color: #334155; }
.pdfr-mag-t { color: #1d4ed8; font-size: 11.5px; }
.pdfr-mag-x { margin-left: auto; border: none; background: #f1f5f9; border-radius: 5px; width: 22px; height: 22px; cursor: pointer; color: #475569; }
.pdfr-mag-x:hover { background: #ef4444; color: #fff; }
.pdfr-mag-view { position: relative; height: 236px; margin-top: 6px; overflow: hidden; background: #eef2f7; border: 1px solid var(--border); border-radius: 6px; }
.pdfr-mag-page { position: absolute; left: 0; top: 0; }
.pdfr-mag-page > img { display: block; width: 100%; height: 100%; }
.pdfr-mag-grid-bg { position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(to right, rgba(47,111,237,.22) 1px, transparent 1px), linear-gradient(to bottom, rgba(47,111,237,.22) 1px, transparent 1px); }
.pdfr-mag-box { position: absolute; border: 2px solid #ef4444; background: rgba(239,68,68,.10); box-sizing: border-box; cursor: move; }
.pdfr-mag-fit { position: absolute; border: 1px dashed #16a34a; background: rgba(22,163,74,.10); box-sizing: border-box; pointer-events: none; }
.pdfr-mag-val { position: absolute; left: 1px; bottom: 0; color: #000; white-space: nowrap; font-family: "SimSun", "宋体", serif; line-height: 1.05; pointer-events: none; }
.pdfr-mag-cross { position: absolute; left: 50%; top: 50%; width: 13px; height: 13px; margin: -7px 0 0 -7px; pointer-events: none; }
.pdfr-mag-cross::before, .pdfr-mag-cross::after { content: ""; position: absolute; background: rgba(239,68,68,.85); }
.pdfr-mag-cross::before { left: 6px; top: 0; width: 1px; height: 13px; }
.pdfr-mag-cross::after { left: 0; top: 6px; width: 13px; height: 1px; }
.pdfr-mag-empty { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 12px; color: var(--text-muted); }
.pdfr-mag-ops { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; }
.pdfr-mag-ops .pdfr-ops-grid { margin-top: 0; }
.pdfr-mag-num { font-size: 11px; color: #334155; margin-top: 4px; line-height: 1.5; }
.pdfr-side { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pdfr-side-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.pdfr-tablewrap { max-height: 60vh; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.pdfr-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.pdfr-table th { position: sticky; top: 0; background: #f1f5f9; text-align: left; font-weight: 600; padding: 4px 6px; border-bottom: 1px solid var(--border); }
.pdfr-table td { padding: 3px 6px; border-bottom: 1px solid #eef2f7; }
.pdfr-table tr:hover td { background: #f8fafc; }
.pdfr-side-tip { font-size: 11px; color: var(--text-muted); line-height: 1.6; }
.pdfr-foot { display: flex; align-items: center; gap: 8px; margin-top: 4px; }

/* 医疗文书自定义弹窗行 */
.meddoc-c-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
/* ★ 2026-09-25：已「彻底删除」的文书名单（不会再自动出现；可单个恢复） */
.meddoc-c-hidden { margin-top: 10px; padding: 8px 10px; background: #fffbeb; border: 1px solid #fcd34d; border-radius: 6px; font-size: 12px; color: #92400e; line-height: 1.9; }
.meddoc-c-htag { display: inline-flex; align-items: center; gap: 4px; margin: 0 6px 4px 0; padding: 1px 4px 1px 8px; background: #fff; border: 1px solid #fcd34d; border-radius: 12px; }
.meddoc-c-htag .btn { height: 20px; padding: 0 6px; font-size: 11px; }
.meddoc-c-kind { font-size: 12px; color: var(--text-muted); min-width: 46px; }
#meddoc-c-list { max-height: 52vh; overflow-y: auto; }
/* 医疗文书预览（屏幕显示；打印走 print.css 的 rx-print 样式） */
.doc-view { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 16px; overflow-x: auto; }
.doc-view .header { font-size: 16px; font-weight: 700; text-align: center; margin-bottom: 10px; letter-spacing: 2px; }
.doc-view .sub-header { font-size: 13px; margin: 6px 0 10px; }
.doc-view .preamble { font-size: 13px; margin-bottom: 8px; }
.doc-view .preamble span { margin-right: 14px; white-space: nowrap; }
.doc-view .exam-print-table { width: 100%; border-collapse: collapse; }
.doc-view .exam-print-table th, .doc-view .exam-print-table td { border: 1px solid var(--border); padding: 6px 8px; font-size: 12px; text-align: left; }
.doc-view .exam-print-table th { background: #f8fafc; }
.doc-view .exam-print-foot { display: flex; gap: 20px; font-size: 13px; margin-top: 10px; }
.doc-view .rp-items { font-size: 13px; margin: 8px 0; }
.doc-view .rp-items .item { padding: 2px 0; }
.doc-view .rx-print-price { font-size: 13px; margin: 8px 0; }
.doc-view .postscript { font-size: 13px; margin-top: 10px; display: flex; gap: 20px; }

/* ============ 保险资料 ============ */
.ins-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  transition: background 0.1s;
}
.ins-item.ins-line {   /* 最近就诊：一行一条，同屏显示更多 */
  padding: 3px 10px;
  font-size: 12px;
  line-height: 1.5;
}
.ins-item:hover { background: var(--primary-light); }
.ins-item.ins-current { background: #e0ecff; border-left: 3px solid var(--primary); }
.ins-item.ins-done { background: #d8f3ec; color: #138a72; }
.ins-item.ins-done.ins-current { background: #bfe8dc; }
.fee-section-title {
  font-size: 14px;
  font-weight: 700;
  margin: 14px 0 6px;
  padding-left: 8px;
  border-left: 3px solid var(--primary);
}
.fee-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 2px solid var(--border);
  font-size: 13px;
}
.report-item { cursor: pointer; }
.report-item:hover { background: var(--primary-light); }

/* 保险费用明细 三线表 */
.ins-fee-title { text-align: center; font-size: 16px; font-weight: 700; letter-spacing: 2px; margin-bottom: 10px; }
.fee-table3 { width: 100%; border-collapse: collapse; font-size: 13px; border-top: 2px solid #000; border-bottom: 2px solid #000; }
.fee-table3 td, .fee-table3 th { padding: 5px 8px; text-align: left; vertical-align: top; border: none; }
.fee-table3 tr.t-info td { text-align: center; font-size: 12.5px; }
.fee-table3 tr.t-dx td { border-bottom: 1px solid #000; }   /* 第二线：动物信息+诊断 与 项目内容 之间 */
.fee-table3 tr.t-head th { border-bottom: 1px solid #000; } /* 项目表头线 */
.fee-table3 tr.t-group td { background: #f5f7fa; font-weight: 600; color: var(--text-secondary); }
.fee-table3 tr td:first-child { text-align: left; }
.fee-table3 tr td:nth-child(2), .fee-table3 tr td:nth-child(3), .fee-table3 tr td:nth-child(4) { text-align: right; }
.fee-table3 tr.t-head th:nth-child(2), .fee-table3 tr.t-head th:nth-child(3), .fee-table3 tr.t-head th:nth-child(4) { text-align: right; }
/* 第三线之后：医生/费用/折扣/折后费用 */
.fee-sum3 { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: flex-end; margin-top: 8px; padding: 8px 4px; font-size: 13px; }
.fee-sum3 span { white-space: nowrap; }
@media print {
  .fee-table3 td, .fee-table3 th { border-color: #000; }
}

/* ============ 统计卡片 ============ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat-value { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* ============ 占位页 ============ */
.placeholder-box {
  background: var(--bg-panel);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}
.placeholder-box .ph-icon { font-size: 48px; margin-bottom: 12px; }
.placeholder-box .ph-title { font-size: 18px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.placeholder-box .ph-desc { font-size: 13px; }

/* ============ 供货商选品 ============ */
.pick-item { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 6px; cursor: pointer; }
.pick-item:hover { background: var(--bg-hover, #f1f5f9); }
.pick-item input.pick-chk { flex: 0 0 auto; width: 16px; height: 16px; cursor: pointer; }
.pick-name { flex: 1; font-size: 13px; }
.pick-type { font-size: 11px; color: var(--text-muted); background: var(--bg, #f1f5f9); border-radius: 4px; padding: 1px 6px; flex: 0 0 auto; }

/* ============ 驱虫/疫苗页：紧凑记录表 ============ */
.im-table th { padding: 4px 6px; white-space: nowrap; }
.im-table td { padding: 3px 6px; }

/* ============ 响应式 ============ */
@media (max-width: 900px) {
  /* 导航已去图标只留文字：窄屏保留文字，仅收窄侧栏宽度即可 */
  :root { --sidebar-width: 150px; }
}

/* 药品/耗材页：分类筛选按钮组（全部/生化/荧光…）独立成行，不与上方页签同排 */
#lib-cat-btns { flex-basis: 100%; margin-top: 2px; }

/* ============ 检查/处置项目检索表：可排序表头 ============ */
.drug-picker-table th.sortable-th { cursor: pointer; user-select: none; white-space: nowrap; }
.drug-picker-table th.sortable-th:hover { color: var(--primary, #3b82f6); }

/* ============ 病历编辑 治疗原则/检查项目选择弹窗（两列 + 行内管理） ============ */
.tp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
/* 选择器按钮区（治疗原则 / 检查项目）：每个按钮=一个项目，自动换行；第一行按使用频率，其余按拼音 */
.tp-chips { display: flex; flex-wrap: wrap; gap: 5px; max-height: 220px; overflow-y: auto; border: 1px solid var(--border, #e5e7eb); border-radius: 6px; padding: 8px; }
.tp-chips .pre-opt { cursor: pointer; }
.tp-item { display: flex; align-items: center; gap: 6px; padding: 3px 4px; font-size: 13px; cursor: pointer; border-radius: 6px; min-width: 0; }
.tp-item:hover { background: #f5f9ff; }
.tp-item input[type="checkbox"] { margin: 0; flex: 0 0 auto; }
.tp-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-mgmt { display: inline-flex; gap: 3px; opacity: 0; transition: opacity .15s; flex: 0 0 auto; }
.tp-item:hover .tp-mgmt { opacity: 1; }
.tp-mgmt .btn { padding: 0 5px; font-size: 11px; line-height: 1.6; }
.tp-rn-input { min-width: 0; }

/* ============ 诊前调查（诊疗·pre 标签） ============ */
.pre-survey { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: start; }
.pre-box { background: #fff; border: 1px solid #E9EEF6; border-radius: 10px; padding: 6px; min-width: 0; box-sizing: border-box; }
.pre-box.pre-wide { grid-column: span 2; }
.pre-box-title { font-size: 12px; font-weight: 700; color: #334155; margin-bottom: 2px; }
.pre-opts { display: flex; flex-wrap: wrap; gap: 5px; }
.pre-opt {
  border: 1px solid #2F6FED; background: #fff; color: #334155;
  font-size: 11px; line-height: 1.2; padding: 1px 8px; border-radius: 12px;
  cursor: pointer; user-select: none;
}
.pre-opt:hover { border-color: #2F6FED; background: #f2f6ff; }
.pre-opt.on { background: #2F6FED; border-color: #2F6FED; color: #fff; font-weight: 600; }
.pre-opt-num { min-width: 26px; text-align: center; font-weight: 600; }
/* 诊前调查·右上角体征录入（仅显示 体重/体温/呼吸/脉搏，一行） */
.pre-vitals-row { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.pre-vitals-row .al-item { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: #334155; }
.pre-vitals-row .al-item:not(.al-vital-item) { display: none; }
.pre-vitals-row .al-label { color: #64748b; font-size: 11px; }
.pre-vitals-row .animal-vital { width: 46px !important; height: 21px !important; padding: 0 4px !important; font-size: 11px; border-radius: 6px; }
.pre-legend { font-size: 11px; color: #999; margin-top: 8px; line-height: 1.6; }
.pre-legend b { color: #555; }
.pre-desc { font-size: 12px; color: var(--text-muted, #6b7280); background: #f4f8f6; border-radius: 6px; padding: 6px 10px; margin-top: 8px; line-height: 1.6; }
.pre-note { margin-top: 8px; }
.pre-notearea { width: 100%; box-sizing: border-box; font-size: 12px; border: 1px solid var(--border, #e5e7eb); border-radius: 6px; padding: 6px 8px; resize: vertical; }

/* ===== 供货商报价审核表（2026-09-22）：列多 → 收紧内边距/行高/字号，尽量不超宽度 ===== */
.sup-quote-table { table-layout: fixed; }
.sup-quote-table th,
.sup-quote-table td { padding: 3px 5px; line-height: 1.35; vertical-align: middle; }
.sup-quote-table th { font-size: 11.5px; white-space: nowrap; }
.sup-quote-table .input { height: 24px !important; padding: 0 4px; font-size: 12px; }
.sup-quote-table td input[type="checkbox"] { margin: 0; }
.sup-quote-table button.btn-sm { padding: 1px 5px; font-size: 11px; line-height: 1.5; }
.sup-quote-table td > div { overflow: hidden; }
.sup-quote-table td.sq-ops { white-space: normal; }
.sup-quote-table td.sq-ops button { white-space: nowrap; margin: 1px 0; }

/* 处方工作区顶部：诊断结论 + 用药版本（按天）+ 调整/打印 **同一行**（2026-09-22 用户口径） */
#rx-preview .rx-top-row {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-bottom: 4px; row-gap: 4px;
}
#rx-preview .rx-top-row .al-label { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
#rx-preview .rx-top-row .rx-hint { font-size: 11.5px; white-space: nowrap; }
#rx-preview .rx-days { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
#rx-preview .rx-days .btn {
  padding: 1px 7px; font-size: 12px; line-height: 1.6; min-width: 40px; font-variant-numeric: tabular-nums;
}
#rx-preview .rx-top-row > .btn { padding: 2px 8px; font-size: 12px; line-height: 1.6; }
/* ===== 耗材按关键词选择（检查/处置项目编辑：窗口可输入 → 下拉显示匹配的耗材「名称+规格」）===== */
.mat-pick-wrap { flex: 1 1 auto; min-width: 0; position: relative; }
.mat-menu { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 2px);
  max-height: 220px; overflow: auto; background: #fff; border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 8px 22px rgba(15,23,42,.18); }
.mat-opt { padding: 5px 8px; cursor: pointer; border-bottom: 1px solid #f1f5f9; }
.mat-opt:last-child { border-bottom: none; }
.mat-opt:hover { background: #eff6ff; }
.mat-opt-n { display: block; font-size: 13px; color: var(--text); }
.mat-opt-s { display: block; font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.mat-empty { padding: 6px 8px; font-size: 11.5px; color: var(--text-muted); line-height: 1.7; }