/* ==========================================================================
   UI v3｜统一主题、浮动底栏、玻璃图标、移动端排版与圆角规范
   加载顺序最后，用于收敛旧样式，确保全站不再出现杂色与尺寸不一致。
   --------------------------------------------------------------------------
   圆角规范（按视觉高度递增）：
     小控件（标签/胶囊）8px · 单行输入与按钮 12px · 常规卡片 16px
     大卡片/弹窗 20px · 浮动底栏 31px（胶囊）
   ========================================================================== */

:root {
  /* 底色与文字：全站统一极浅蓝页面底 #f0f9fe + 白色卡片 */
  --color-bg: #f0f9fe;
  --color-paper: #f0f9fe;
  --color-surface: #ffffff;
  --color-surface-2: #f7f9fc;
  --color-surface-3: #eef2f7;
  --color-text: #1f2430;
  --color-muted: #5f6b7a;
  --color-faint: #8c96a4;
  --color-border: #edf0f5;
  --color-border-strong: #dfe5ee;

  /* 圆角 */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-pill: 999px;

  /* 字号：按 390px 常规手机视口设定 */
  --fs-2xs: 11px;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 15px;
  --fs-md: 16px;
  --fs-lg: 18px;
  --fs-xl: 20px;

  --header-h: 52px;
  --sh-1: none;
  --sh-2: none;

  /* 全站页面底图：与电子病历页共用同一张图，只在 .app-shell 与全屏问诊顶栏引用此变量，
     不再各处重复写 url，避免维护多套底图资源。 */
  --h5-bg: url('../h5-bg.png?v=20261115-11');
}

html { -webkit-text-size-adjust: 100%; }
body { background: var(--color-bg); font-size: var(--fs-base); }
body, .app-shell, .app-view, body[data-mode="form"] .app-view {
  background-color: var(--color-bg) !important;
  background-image: none !important;
}
.app-view.is-tabbed { padding-bottom: calc(104px + env(safe-area-inset-bottom)); }

/* ---------------- 顶栏：白底、居中标题、无右上角图标 ---------------- */
.app-header {
  position: static;
  width: 100%; max-width: var(--page-max);
  margin: 0 auto;
  z-index: 50;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  min-height: var(--header-h);
  padding: 0 8px;
  padding-top: env(safe-area-inset-top);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: none;
}
.app-header::after { content: ''; grid-column: 3; grid-row: 1; }
.app-header .hd-back {
  grid-column: 1;
  grid-row: 1;
  position: static;
  transform: none;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  color: var(--color-text);
}
.app-header .hd-back:active { background: var(--color-surface-2); }
.app-header .hd-main { grid-column: 2; grid-row: 1; text-align: center; min-width: 0; }
.app-header .hd-title { font-size: 17px; font-weight: 600; letter-spacing: .01em; }
.app-header .hd-sub { margin-top: 1px; font-size: 11.5px; }
.app-header .hd-action, .app-header .hd-done { display: none !important; }

/* ---------------- 浮动胶囊底栏（参考图 2） ---------------- */
.app-tabbar {
  position: sticky;
  bottom: 0;
  z-index: 30;
  display: block;
  height: auto;
  min-height: 0;
  padding: 0 12px calc(10px + env(safe-area-inset-bottom));
  background: transparent;
  border: 0;
  box-shadow: none;
}
.tabbar-inner {
  display: flex;
  align-items: stretch;
  height: 62px;
  padding: 6px;
  background: rgba(255, 255, 255, .95);
  border: 1px solid rgba(226, 232, 240, .9);
  border-radius: 31px;
  box-shadow: 0 8px 26px rgba(23, 43, 77, .10);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.app-tabbar .tab-item {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  height: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  border-radius: 26px;
  color: #9aa4b2;
  font-size: var(--fs-2xs);
  line-height: 1.2;
}
.app-tabbar .tab-item .ti-ico { width: 24px; height: 24px; display: grid; place-items: center; }
.app-tabbar .tab-item .ti-ico svg { width: 22px; height: 22px; stroke-width: 1.65; }
.app-tabbar .tab-item .ti-label { font-size: var(--fs-2xs); letter-spacing: .01em; }
.app-tabbar .tab-item.is-active { color: var(--color-primary); }
.app-tabbar .tab-item.is-active .ti-label { font-weight: 600; }
.app-tabbar .tab-item.is-active::after { display: none; }
.app-tabbar .tab-item:active { background: var(--color-surface-2); }

/* 中间「开方」为凸起圆形主按钮 */
.app-tabbar .tab-item.is-center { justify-content: flex-end; }
.app-tabbar .tab-item.is-center .ti-ico {
  position: absolute;
  left: 50%;
  top: -17px;
  transform: translateX(-50%);
  width: 54px; height: 54px;
  border-radius: 50%;
  border: 3px solid #fff;
  background-color: var(--color-primary);
  background-image: var(--gradient-brand);
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
  color: #fff;
  box-shadow: 0 10px 20px var(--shadow-primary), inset 0 1px 0 rgba(255, 255, 255, .45);
}
.app-tabbar .tab-item.is-center .ti-ico svg { width: 25px; height: 25px; stroke-width: 1.9; }
.app-tabbar .tab-item.is-center .ti-label { margin-bottom: 1px; color: var(--color-muted); font-weight: 500; }
.app-tabbar .tab-item.is-center.is-active .ti-label { color: var(--color-primary); font-weight: 600; }

/* ---------------- 卡片与圆角 ---------------- */
.m-card { border-radius: var(--r-lg); border: 1px solid var(--color-border); box-shadow: none; padding: 15px; }
.m-card.flat { border: 0; background: var(--color-surface-2); }
.m-card.clickable:active { background: var(--color-surface-2); }
.m-card-top { gap: 10px; }

/* 高度较高 / 视觉主体：更大圆角 */
.m-banner { border-radius: var(--r-xl); }
.m-face-card { border-radius: var(--r-xl); padding: 24px 18px 20px; }
.m-profile-head { border-radius: var(--r-xl); }
.m-doctor-bar { border-radius: var(--r-xl) !important; }
.m-grid5 { border-radius: var(--r-xl); }
.m-list-card { border-radius: var(--r-xl); }
.m-rx-item { border-radius: var(--r-lg); padding: 14px; }
.m-signature { border-radius: var(--r-lg); }

/* 中等高度：14~16px */
.m-action { border-radius: var(--r-lg); padding: 15px; }
.m-entry { border-radius: var(--r-lg); }
.m-result-body .m-result-row { border-radius: 0; }

/* 低高度控件：10~12px */
.m-select-field { min-height: 44px; border-radius: var(--r-md); font-size: var(--fs-base); }
.m-select-field svg { width: 16px; height: 16px; }
.m-search .input { min-height: 44px; border-radius: var(--r-md); }
.m-money { border-radius: var(--r-md); padding: 14px; }
.m-review { border-radius: var(--r-md); padding: 12px; }
.m-tabs { border-bottom: 1px solid var(--color-border); }
.m-pager .select, .m-pager .btn { border-radius: var(--r-md); }
.m-icon-btn { border-radius: var(--r-sm); }
.m-chip { border-radius: var(--r-sm); padding: 6px 10px; font-size: var(--fs-xs); }
.m-sign-preview { border-radius: var(--r-sm); }
.m-avatar { border-radius: 14px; }
.m-dx-picker-item .check { border-radius: 6px; }

/* ---------------- 分段控件：文字单行，随主题色 ---------------- */
.segment {
  display: flex; gap: 3px; padding: 3px; width: auto;
  background: var(--color-surface-3); border: 1px solid var(--color-border);
  border-radius: var(--r-md);
}
.segment button {
  flex: 1 1 auto; min-height: 38px; padding: 0 14px;
  white-space: nowrap; border: 0 !important; border-radius: var(--r-sm) !important;
  background: transparent; color: var(--color-muted);
  font-size: var(--fs-sm); font-weight: 500; box-shadow: none;
}
.segment button.is-active { background: var(--color-primary); color: #fff; font-weight: 600; }

/* ---------------- 分区标题：左侧竖线 + 标题，右侧附注/操作 ---------------- */
.m-section-title { justify-content: flex-start; gap: 0; }
.m-section-title h2 { flex: 0 0 auto; }
.m-section-title > .sub,
.m-section-title > .m-title-actions { margin-left: auto; }

/* ---------------- 字号：手机最佳可读性 ---------------- */
.m-section-title h2 { font-size: 17px; }
.m-section-title .sub { font-size: var(--fs-xs); }
.m-card-title { font-size: var(--fs-base); }
.m-card-desc { font-size: var(--fs-sm); line-height: 1.65; }
.m-card-foot { font-size: var(--fs-xs); display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--color-faint); }
.m-card-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 12px; }
.m-card-actions .btn { width: auto; flex: 0 0 auto !important; min-height: 38px; padding: 0 16px; font-size: var(--fs-sm); }
.m-card-actions .btn { min-height: 40px; font-size: var(--fs-sm); }
.m-patient-name { font-size: var(--fs-md); }
.m-patient-name small { font-size: var(--fs-xs); }
.m-patient-sub { font-size: var(--fs-xs); }
.m-info-item .k { font-size: var(--fs-xs); }
.m-info-item .v { font-size: 14px; }
.m-face-card h2 { font-size: 18px; }
.m-face-card p { font-size: var(--fs-sm); line-height: 1.65; }
.m-quick b { font-size: var(--fs-base); }
.m-quick span { font-size: var(--fs-xs); }
.m-record-item { padding: 13px 0; }
.m-record-item .title { font-size: 14px; }
.m-record-item .desc { font-size: var(--fs-sm); }
.m-record-item .time { font-size: var(--fs-xs); }
.m-result-row { padding: 11px 0; }
.m-result-row .k { font-size: var(--fs-xs); }
.m-result-row .v { font-size: 14px; }
.m-action-main b { font-size: var(--fs-base); }
.m-action-main span { font-size: var(--fs-xs); line-height: 1.55; }
.m-pager { font-size: var(--fs-xs); }
.m-form .field-label { font-size: var(--fs-sm); }
.m-rx-item-head .name { font-size: 14px; }
.m-rx-item-head .spec { font-size: var(--fs-xs); }
.m-rx-item .input, .m-rx-item .select { min-height: 42px; font-size: 14px; }
.m-money span { font-size: var(--fs-sm); }
.m-dx-picker-item { padding: 14px 4px; }
.m-dx-picker-item .name { font-size: 14px; }
.m-dx-picker-item .code { font-size: var(--fs-xs); }
.m-version { font-size: var(--fs-xs); }
.m-profile-head .name { font-size: 19px; }
.m-profile-head .sub { font-size: var(--fs-xs); }
.m-empty-inline { font-size: var(--fs-sm); padding: 26px 12px; }
.badge, .m-card .badge { font-size: var(--fs-2xs); }

/* 输入类统一 16px，避免 iOS 聚焦自动放大 */
.input, .select, .textarea { font-size: 16px; min-height: 44px; }
.textarea { min-height: 88px; padding: 11px 12px; }
.select { border-radius: var(--r-md); }
.input { border-radius: var(--r-md); }
.btn { min-height: 44px; border-radius: var(--r-md); font-size: var(--fs-base); }
.btn-sm { min-height: 34px; font-size: var(--fs-xs); }
.btn-block { width: 100%; }

/* 表单内输入框：浅底 + 淡灰边框（覆盖旧版发丝线透明输入） */
.m-form .field { border-bottom: 0 !important; }
.m-form > .field { padding: 0 0 14px !important; }
.m-form > .field > .field-label,
.m-form .grid-2 > .field > .field-label,
.m-form .grid-3 > .field > .field-label {
  margin-bottom: 7px !important;
  color: var(--color-muted) !important;
  font-size: var(--fs-sm) !important;
  font-weight: 500 !important;
}
.m-form .input,
.m-form .select,
.m-form .textarea,
body[data-mode="form"] .m-form .input,
body[data-mode="form"] .m-form .select,
body[data-mode="form"] .m-form .textarea {
  background: var(--color-surface-2) !important;
  border: 1px solid var(--color-border) !important;
  border-radius: var(--r-md) !important;
  box-shadow: none !important;
  min-height: 44px;
  padding: 10px 14px !important;
  font-size: 16px !important;
  color: var(--color-text) !important;
  text-align: left !important;
  text-align-last: left !important;
}
.m-form .textarea,
body[data-mode="form"] .m-form .textarea { min-height: 92px; line-height: 1.6; padding: 11px 14px !important; }
.m-form .input:focus,
.m-form .select:focus,
.m-form .textarea:focus,
body[data-mode="form"] .m-form .input:focus,
body[data-mode="form"] .m-form .select:focus,
body[data-mode="form"] .m-form .textarea:focus {
  background: var(--color-surface) !important;
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 0 3px var(--color-primary-soft) !important;
}
.m-form .input[readonly],
body[data-mode="form"] .m-form .input[readonly] { color: var(--color-muted) !important; background: var(--color-surface-3) !important; }
.m-form .m-select-field { background: var(--color-surface-2) !important; border: 1px solid var(--color-border) !important; box-shadow: none !important; }
.m-form .m-select-field:active { border-color: var(--color-primary) !important; }
.m-form .segment { border: 1px solid var(--color-border); border-radius: var(--r-md); background: var(--color-surface-2); }

/* 录入页：白卡留边、字段上下排布，避免贴边与横向挤压 */
body[data-mode="form"] .m-page { padding: 14px 14px 28px !important; background: var(--color-bg) !important; }
body[data-mode="form"] .m-page > .m-card {
  margin: 0 0 12px !important;
  padding: 15px !important;
  border-radius: var(--r-lg) !important;
  background: var(--color-surface) !important;
}
/* 患者会员卡：表单页保留渐变底，不被白底覆盖 */
body[data-mode="form"] .m-page > .m-card.m-patient-vip {
  background: var(--gradient-brand) !important;
  border: 0 !important;
  color: #fff !important;
}
body[data-mode="form"] .m-form.m-card {
  margin: 12px 0 0 !important;
  padding: 16px 14px !important;
  border-radius: var(--r-lg) !important;
  border: 1px solid var(--color-border) !important;
  background: var(--color-surface) !important;
}
body[data-mode="form"] .m-form.m-card > .field,
body[data-mode="form"] .m-form.m-card .grid-2 > .field,
.modal-body .m-form > .field {
  display: block !important;
  padding-bottom: 14px !important;
}
body[data-mode="form"] .m-form.m-card > .field > .field-label,
body[data-mode="form"] .m-form.m-card .grid-2 > .field > .field-label,
.modal-body .m-form > .field > .field-label {
  display: block !important;
  margin-bottom: 7px !important;
}
body[data-mode="form"] .m-form.m-card > .field > .input,
body[data-mode="form"] .m-form.m-card > .field > .select,
body[data-mode="form"] .m-form.m-card > .field > .textarea,
.modal-body .m-form > .field > .input,
.modal-body .m-form > .field > .select,
.modal-body .m-form > .field > .textarea {
  width: 100% !important;
  display: block !important;
}
body[data-mode="form"] .m-form.m-card > .field > .m-select-field,
.modal-body .m-form > .field > .m-select-field {
  width: 100% !important;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
body[data-mode="form"] .m-form.m-card .m-chip-row,
.modal-body .m-form .m-chip-row { margin-top: 8px; }
body[data-mode="form"] .m-form.m-card > .btn-block { margin-top: 4px; }

/* ---------------- 玻璃质感图标 ---------------- */
.gi { display: block; width: 40px; height: 40px; flex: 0 0 auto; }
.gi { filter: drop-shadow(0 3px 5px var(--shadow-primary)); }
.m-face-icon, .m-action-icon, .mg-ico, .me-ico, .ml-ico {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: var(--color-primary);
}
.m-face-icon { width: auto; height: auto; }
.m-face-icon .gi { width: 56px; height: 56px; }
.m-action-icon { width: 40px; height: 40px; flex: 0 0 40px; }
.m-action-icon .gi { width: 40px; height: 40px; }
.m-action-icon .m-action-img { width: 100%; height: 100%; object-fit: contain; }
.mg-ico { width: 46px; height: 46px; display: grid; place-items: center; }
.mg-ico .gi { width: 46px; height: 46px; }
.me-ico { width: 40px; height: 40px; display: grid; place-items: center; }
.me-ico .gi { width: 40px; height: 40px; }
.ml-ico { width: 36px; height: 36px; display: grid; place-items: center; }
.ml-ico .gi { width: 34px; height: 34px; }

/* ---------------- 首页结构：浅灰底 + 白色卡片 ---------------- */
.m-doctor-bar {
  background: var(--color-surface) !important;
  border: 1px solid var(--color-border) !important;
  box-shadow: none !important;
  color: var(--color-text) !important;
  padding: 14px 16px !important;
}
.m-doctor-bar .md-name { color: var(--color-text); font-size: var(--fs-md); }
.m-doctor-bar .md-sub { color: var(--color-muted); font-size: var(--fs-xs); }
.m-doctor-bar .md-avatar, .m-profile-head .m-avatar {
  background: var(--gradient-brand);
  color: #fff;
}
.m-entry-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.m-entry {
  display: flex; align-items: center; gap: 10px; min-height: 66px;
  padding: 12px; background: var(--color-surface);
  border: 1px solid var(--color-border); text-align: left;
}
.m-entry:active { background: var(--color-surface-2); }
.me-txt { min-width: 0; }
.me-txt b { display: block; font-size: var(--fs-base); font-weight: 600; }
.me-txt span { display: block; margin-top: 2px; color: var(--color-faint); font-size: var(--fs-xs); }
.m-grid5 {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px;
  margin-top: 12px; padding: 16px 6px 14px;
  background: var(--color-surface); border: 1px solid var(--color-border);
}
.m-grid5-item {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 2px 0; color: var(--color-muted); font-size: var(--fs-xs);
}
.m-grid5-item:active { opacity: .75; }
.m-notice {
  margin-top: 12px; padding: 12px 14px;
  background: var(--color-primary-soft); color: var(--color-primary-strong);
  border-radius: var(--r-lg); font-size: var(--fs-sm);
  display: flex; align-items: center; gap: 8px;
}
.m-list-card {
  margin-top: 12px; padding: 4px 16px;
  background: var(--color-surface); border: 1px solid var(--color-border);
}
.m-list-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 14px 0; border-bottom: 1px solid var(--color-border); text-align: left;
}
.m-list-item:last-child { border-bottom: 0; }
.ml-main { flex: 1 1 auto; min-width: 0; }
.ml-main b { display: block; font-size: var(--fs-base); font-weight: 600; }
.ml-main span { display: block; margin-top: 2px; color: var(--color-faint); font-size: var(--fs-xs); }
.m-list-item > svg { width: 16px; height: 16px; color: var(--color-faint); }

/* ---------------- 我的 ---------------- */
.m-profile-head {
  background: var(--color-surface) !important;
  color: var(--color-text) !important;
  border: 1px solid var(--color-border);
  padding: 18px 16px;
}
.m-profile-head .name { color: var(--color-text); }
.m-profile-head .sub { color: var(--color-muted) !important; opacity: 1; }
.m-profile-head .m-avatar { border-radius: 50%; }
.m-action-list-mini { margin-top: 10px; }
/* 文章详情：富文本配图显示设置（比例 / 宽度 / 对齐） */
.m-article-body img.ae-img { display: block; max-width: 100%; width: 100%; height: auto; margin: 12px auto; border-radius: 8px; }
.m-article-body img.ae-img[data-width="75"] { width: 75%; }
.m-article-body img.ae-img[data-width="50"] { width: 50%; }
.m-article-body img.ae-img[data-ratio="1-1"] { aspect-ratio: 1 / 1; object-fit: cover; }
.m-article-body img.ae-img[data-ratio="4-3"] { aspect-ratio: 4 / 3; object-fit: cover; }
.m-article-body img.ae-img[data-ratio="16-9"] { aspect-ratio: 16 / 9; object-fit: cover; }
.m-article-body img.ae-img[data-align="left"] { margin-left: 0; margin-right: auto; }
.m-article-body img.ae-img[data-align="right"] { margin-left: auto; margin-right: 0; }

/* ---------------- 弹窗：浅灰底 + 白色卡片 ---------------- */
.overlay { background: rgba(15, 23, 42, .42); }
.modal {
  border-radius: 22px;
  background: var(--color-surface);
  box-shadow: 0 24px 64px rgba(15, 23, 42, .22);
  overflow: hidden;
}
.modal-head { background: var(--color-surface); border-bottom: 1px solid var(--color-border); padding: 14px 16px; }
.modal-head .mh-title { font-size: 17px; }
.modal-body { background: var(--color-surface) !important; padding: 14px; }
.modal-foot { background: var(--color-surface); border-top: 1px solid var(--color-border); padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); }
.modal-foot .btn { min-height: 44px; }
.modal-body > .m-form,
.modal-body > .stack,
.modal-body > .m-card,
.modal-body > .theme-grid,
.modal-body > .pick-list,
.modal-body > #dxOptions {
  background: var(--color-surface);
  border-radius: var(--r-lg);
  padding: 15px;
  border: 0;
}
.modal-body > .m-form + .m-form, .modal-body > .m-card + .m-card { margin-top: 12px; }
.modal-body .m-card.flat { background: var(--color-surface-2); border-radius: 14px; padding: 13px; }
.modal-body .search-bar { background: var(--color-surface); border-radius: var(--r-md); }
.modal-body .m-search { margin-bottom: 10px; }
.modal-body .m-search .input { background: var(--color-surface); }
.modal-body .pick-list { padding: 0 14px; }
.modal-body .m-chip-row { margin: 0 2px 10px; }
.modal-body > .theme-grid + .notice { margin-top: 12px; }

/* 主题色选择 */
.theme-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 8px; }
.theme-grid + .notice { border-radius: var(--r-md); }
.theme-swatch {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 6px 0; background: transparent; border: 0;
}
.ts-dot {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45);
}
.ts-dot svg { width: 20px; height: 20px; opacity: 0; stroke-width: 2.4; }
.theme-swatch.is-active .ts-dot { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--color-primary); }
.theme-swatch.is-active .ts-dot svg { opacity: 1; }
.ts-name { font-size: var(--fs-xs); color: var(--color-muted); }
.theme-swatch.is-active .ts-name { color: var(--color-primary); font-weight: 600; }

/* ---------------- 其余细节收敛 ---------------- */
.m-result-icon { background: var(--color-primary-soft); color: var(--color-primary); }
.m-result-head { padding: 22px 16px; }
.m-result-head h2 { font-size: 18px; }
.m-result-head p { font-size: var(--fs-xs); }
.m-tabs button { min-height: 44px; font-size: 14px; }
.m-search svg { width: 16px; height: 16px; }
.m-card-actions .btn svg, .btn svg { width: 16px; height: 16px; }
.notice { border-radius: var(--r-md); font-size: var(--fs-sm); }
.m-title-actions .btn { min-height: 36px; font-size: var(--fs-xs); }
.m-title-actions .select {
  min-height: 36px;
  font-size: var(--fs-xs);
  padding: 5px 20px;
  text-align: center;
  background-position: right 9px center;
}

/* ---------------- 收敛旧版首页蓝色牌匾，统一为浅灰底 + 白卡 ---------------- */
@media screen {
  body[data-route="inquiry"] .app-view.is-tabbed::before { display: none !important; }
  body[data-route="inquiry"] .app-view.is-tabbed > .m-page { position: static; }
  .m-doctor-bar .md-name { color: var(--color-text) !important; }
  .m-doctor-bar .md-sub { color: var(--color-muted) !important; }
}

/* 旧样式对 svg 的尺寸约束优先级更高，这里统一锁定玻璃图标大小 */
.m-entry .me-ico .gi { width: 40px !important; height: 40px !important; }
.m-grid5 .mg-ico .gi { width: 46px !important; height: 46px !important; }
.m-grid5 .mg-ico { width: 46px !important; height: 46px !important; }
.m-grid5 .mg-ico .mg-img { width: 42px; height: 42px; object-fit: contain; border-radius: 0; }
/* 首页宫格：无图片时回退内联线性小图标（主题色） */
.m-grid5 .mg-ico > .ic.mg-line {
  width: 32px !important;
  height: 32px !important;
  color: var(--color-primary);
  stroke-width: 1.7;
  filter: none;
}
.m-list-card .ml-ico .gi { width: 34px !important; height: 34px !important; }
.m-action .m-action-icon .gi { width: 40px !important; height: 40px !important; }
.m-face-card .m-face-icon .gi { width: 56px !important; height: 56px !important; }
.m-grid5-item { font-size: var(--fs-xs) !important; }
.m-grid5-item > span:last-child { color: var(--color-muted); }
.m-entry .me-txt b { font-size: var(--fs-base); }
.m-entry .me-txt > span { font-size: var(--fs-xs); color: var(--color-faint); }

@media (max-width: 360px) {
  :root { --fs-base: 14px; }
  .m-page { padding-left: 12px; padding-right: 12px; }
  .app-tabbar .tab-item .ti-label { font-size: 10px; }
  .mg-ico, .mg-ico .gi { width: 42px !important; height: 42px !important; }
  .theme-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ==========================================================================
   UI v4｜圆形人脸框、手机尺寸弹窗、参考图底栏、结构化处方/病历与 A5 处方笺
   ========================================================================== */

/* ---------------- 1. 人脸识别：圆形镜头框 ---------------- */
.fa-cam {
  width: 200px; height: 200px;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 0 0 6px var(--color-primary-soft), inset 0 0 0 1px var(--color-primary-line);
}
.fa-cam video { border-radius: 50%; }
.fa-cam .fa-corner { display: none; }
.fa-cam .fa-face { color: var(--color-primary); opacity: .45; }
.fa-cam .fa-ring {
  position: absolute; inset: 13px; z-index: 2; border-radius: 50%;
  border: 2px solid var(--color-primary-line);
  box-shadow: inset 0 0 24px rgba(88, 180, 255, .14);
  pointer-events: none;
}
.fa-cam .fa-line { left: 22px; right: 22px; z-index: 2; }
.fa-stage .fa-title { font-size: 17px; }
.fa-stage .fa-desc { font-size: 13px; }

/* ---------------- 2. 弹窗：严格限制为手机尺寸，字号放大 ---------------- */
.overlay { padding: 0 12px; }
.overlay:has(.modal.is-fullscreen) { padding: 0; }
.modal, .modal.is-wide { width: 100%; max-width: 402px; }
.modal { border-radius: 22px 22px 0 0; }

/* 全屏弹窗：新建病历 / 新建处方 / 添加药品 / 添加诊断等长表单 */
.modal.is-fullscreen {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  width: 100vw; max-width: none;
  height: 100dvh; max-height: none;
  border-radius: 0;
  display: flex; flex-direction: column;
}
.modal.is-fullscreen .modal-head { flex-shrink: 0; padding: 16px 16px; }
.modal.is-fullscreen .modal-body {
  flex: 1 1 auto; min-height: 0;
  padding: 14px 14px calc(20px + env(safe-area-inset-bottom));
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
.modal.is-fullscreen .modal-body > .pick-list {
  height: calc(100dvh - 56px - 72px); /* 屏高 - head - search+chip 区 */
  overflow-y: auto; padding: 0 6px;
}
.modal.is-fullscreen #dxOptions {
  height: calc(100dvh - 56px - 180px);
  max-height: none !important;
  overflow-y: auto;
}
.modal.is-fullscreen .modal-foot { flex-shrink: 0; padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); }
/* 手机端把全屏弹窗的头尾压到最小，可视空间尽量让给表单内容；滚动仍留在 body */
@media (max-width: 480px) {
  .modal.is-fullscreen .modal-head {
    min-height: 52px; box-sizing: border-box;
    padding: 10px 16px;
  }
  .modal.is-fullscreen .modal-head .mh-title { font-size: 16px; }
  .modal.is-fullscreen .modal-body {
    padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
    overscroll-behavior: contain;
  }
  .modal.is-fullscreen .modal-foot {
    padding: 8px 14px calc(8px + env(safe-area-inset-bottom));
  }
  .modal.is-fullscreen .modal-foot .btn { min-height: 44px; }
}

/* 首页「问诊 / 立即问诊」全屏入口：顶栏沿用全站图片底图与页面标题口径 */
.modal.is-fullscreen .modal-head.is-inquiry-hero {
  position: relative;
  display: flex; align-items: center;
  height: calc(104px + env(safe-area-inset-top, 0px));
  min-height: calc(104px + env(safe-area-inset-top, 0px));
  padding: max(54px, env(safe-area-inset-top)) 16px 14px;
  background-color: transparent !important;
  /* 复用全站底图（与电子病历页同一张），只引用变量，不单独维护 */
  background-image: var(--h5-bg) !important;
  background-repeat: no-repeat;
  background-position: top center;
  background-size: 100% auto;
  border-bottom: 0 !important;
  box-shadow: none;
  color: #1b3a6b;
}
/* 标题占满整行并居中，关闭按钮脱离文档流，避免挤压标题导致视觉偏左 */
.modal.is-fullscreen .modal-head.is-inquiry-hero .mh-title {
  flex: 1 1 auto;
  min-width: 0;
  color: #1b3a6b !important;
  font-size: 18px; font-weight: 700; letter-spacing: .02em;
  text-align: center;
  position: relative; z-index: 1;
}
.modal.is-fullscreen .modal-head.is-inquiry-hero .mh-close {
  position: absolute;
  right: 14px;
  top: max(54px, env(safe-area-inset-top, 0px));
  bottom: 14px;
  margin: auto 0;
  color: #1b3a6b;
  z-index: 1;
}
/* 顶栏不再叠加渐变遮罩：底图自带柔和过渡 */
.modal.is-fullscreen .modal-head.is-inquiry-hero + .modal-body {
  background: var(--color-bg) !important;
  padding-top: 30px;
}
.modal.is-fullscreen .modal-head.is-inquiry-hero + .modal-body > .m-form {
  background: transparent !important;
}

@media (min-width: 700px) {
  .modal, .modal.is-wide { border-radius: 22px; max-height: 88vh; }
}
.modal-head { padding: 15px 16px; }
.modal-head .mh-title { font-size: 17px; }
.modal-head .mh-close { width: 36px; height: 36px; }
.modal-body { font-size: 14px; padding: 14px; }
.modal-foot { padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); }
.modal-foot .btn { min-height: 46px; font-size: 15px; }

.modal-body .m-form .field-label,
.modal-body .field-label { font-size: 13.5px; font-weight: 500; color: var(--color-muted); }
.modal-body .m-card-title { font-size: 16px; }
.modal-body .m-card-desc { font-size: 14px; line-height: 1.65; }
.modal-body .m-patient-name { font-size: 16px; }
.modal-body .m-patient-sub { font-size: 12.5px; }
.modal-body .m-info-item .k { font-size: 12.5px; }
.modal-body .m-info-item .v { font-size: 14.5px; }
.modal-body .notice { font-size: 13.5px; }
.modal-body .m-empty-inline { font-size: 13.5px; }
.modal-body .m-chip { font-size: 12.5px; }
.modal-body .m-search .input { font-size: 15px; }
.modal-body .m-rx-item .field-label { font-size: 13px; }
.modal-body .m-rx-item .input,
.modal-body .m-rx-item .select { min-height: 42px; font-size: 14.5px; }
.modal-body .m-select-field { min-height: 46px; font-size: 14.5px; }
.modal-body .m-form { gap: 14px; }
.modal-body .m-form > .field { padding-bottom: 4px !important; }

/* ---------------- 3. 底部菜单：参考图的白色漂浮面板 + 凸起圆形主按钮 ---------------- */
.app-tabbar { padding: 0 14px calc(12px + env(safe-area-inset-bottom)); }
.tabbar-inner {
  position: relative;
  height: 82px;
  padding: 6px 10px 24px;
  border-radius: 26px;
  background: rgba(255, 255, 255, .97);
  border: 1px solid rgba(228, 233, 241, .9);
  box-shadow: 0 10px 28px rgba(23, 43, 77, .12);
}
.app-tabbar .tab-item {
  height: 48px;
  justify-content: flex-start;
  gap: 5px;
  padding-top: 3px;
  border-radius: 18px;
  color: #97a1b0;
  font-size: 11px;
}
.app-tabbar .tab-item .ti-ico {
  width: 24px; height: 24px; color: #9aa4b2;
  background-image: var(--tab-icon, none);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  filter: grayscale(1); opacity: 0.55;
}
.app-tabbar .tab-item .ti-ico svg { width: 23px; height: 23px; stroke-width: 1.5; }
.app-tabbar .tab-item.is-active .ti-ico {
  opacity: 1;
  filter: brightness(0) sepia(1) saturate(3500%) hue-rotate(210deg);
}
/* 中间按钮：图标用伪元素单独渲染为白色，不影响蓝色渐变底 */
.app-tabbar .tab-item.is-center .ti-ico {
  filter: none;
  opacity: 1;
}
.app-tabbar .tab-item.is-center .ti-ico::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--tab-icon, none);
  background-size: 26px 26px;
  background-repeat: no-repeat;
  background-position: center;
  filter: brightness(0) invert(1);
}
.app-tabbar .tab-item .ti-label { font-size: 11px; font-weight: 500; letter-spacing: .02em; }
.app-tabbar .tab-item.is-active { color: var(--color-primary); }
.app-tabbar .tab-item.is-active .ti-label { font-weight: 600; }
.app-tabbar .tab-item.is-center { justify-content: flex-end; padding-bottom: 2px; }
.app-tabbar .tab-item.is-center .ti-ico {
  top: -24px;
  width: 58px; height: 58px;
  border: 4px solid #fff;
  background-color: var(--color-primary);
  background-image: var(--gradient-brand);
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
  box-shadow: 0 0 0 1px rgba(47, 109, 246, .35), 0 12px 24px var(--shadow-primary), inset 0 1px 0 rgba(255, 255, 255, .5);
}
.app-tabbar .tab-item.is-center .ti-ico svg { width: 26px; height: 26px; stroke-width: 1.9; }
.app-tabbar .tab-item.is-center .ti-label { margin-bottom: 1px; color: #97a1b0; font-weight: 500; }
.app-tabbar .tab-item.is-center.is-active .ti-label { color: var(--color-primary); font-weight: 600; }
.tabbar-inner::after {
  content: ''; position: absolute; left: 50%; bottom: 5px;
  width: 104px; height: 3px; transform: translateX(-50%);
  border-radius: 99px; background: var(--color-primary-soft);
}

/* ---------------- 4. 所有下拉控件统一箭头 ---------------- */
.select {
  appearance: none; -webkit-appearance: none;
  padding-right: 32px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235f6b7a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 14px 14px !important;
}
.m-select-field svg { color: var(--color-faint); }
.m-select-field:active svg { color: var(--color-primary); }

/* ---------------- 5. 处方 / 病历结构化详情 ---------------- */
.rxd { display: flex; flex-direction: column; gap: 10px; }
.rxd-card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: 14px; padding: 13px 14px;
}
.rxd-card > h4 {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 0 0 10px; font-size: 14.5px; font-weight: 600; color: var(--color-text);
}
.rxd-card > h4 > span { font-size: 12px; font-weight: 500; color: var(--color-faint); }
.rxd-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.rxd-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rxd-cell { min-width: 0; }
.rxd-cell.wide { grid-column: 1 / -1; }
.rxd-cell .k { display: block; font-size: 12px; color: var(--color-faint); line-height: 1.4; }
.rxd-cell .v { display: block; margin-top: 2px; font-size: 14px; line-height: 1.55; color: var(--color-text); word-break: break-all; }
.rxd-cell .v.mono { font-family: var(--font-mono); font-size: 13px; }
.rxd-para { font-size: 14px; line-height: 1.75; color: var(--color-text); white-space: pre-wrap; }
.rxd-drug { border: 1px solid var(--color-border); border-radius: 12px; padding: 11px 12px; background: var(--color-surface-2); }
.rxd-drug + .rxd-drug { margin-top: 8px; }
.rxd-drug-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.rxd-drug-head b { font-size: 14.5px; font-weight: 600; }
.rxd-drug-head span { flex: 0 0 auto; font-family: var(--font-mono); font-size: 13px; color: var(--color-primary); }
.rxd-total {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 15px; border-radius: 14px;
  background: var(--color-primary-soft); color: var(--color-primary-strong); font-size: 14px;
}
.rxd-total b { font-family: var(--font-mono); font-size: 20px; }
.rxd-field + .rxd-field { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--color-border); }
.rxd-field .k { display: block; font-size: 12px; color: var(--color-faint); }
.rxd-field .v { display: block; margin-top: 3px; font-size: 14px; line-height: 1.75; white-space: pre-wrap; word-break: break-word; }
.rxd-subtitle { margin: 12px 0 8px; font-size: 13px; font-weight: 600; color: var(--color-muted); }
.rxd-subtitle:first-child { margin-top: 0; }

/* ---------------- 6. A5 处方笺 / 病历纸张（对齐参考图版式） ---------------- */
.paper-export-host { position: fixed; left: -10000px; top: 0; z-index: -1; }
.paper-doc { display: block; }
.paper-top { position: relative; padding: 2px 0 4px; min-height: 60px; }
.paper-barcode { position: absolute; left: 0; top: 4px; width: 146px; height: 40px; background: #fff; }
.paper-barcode .barcode-svg { display: block; width: 100%; height: 100%; }
.paper-barcode .barcode-fallback { font: 10px/1.4 var(--font-mono); color: #111; }
.paper-hospital {
  padding: 14px 96px 0 156px;
  text-align: center; font-size: 20px; font-weight: 700;
  letter-spacing: .1em; line-height: 1.35;
}
.paper-seal { position: absolute; right: 12%; top: 0; width: 84px; height: 84px; opacity: .92; }
.paper-seal-img { object-fit: contain; }
.paper-line { border: 0; border-top: 1.4px solid #222; margin: 4px 0 0; }
.paper-numrow {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 8px 0 7px; font-size: 12px; border-bottom: 1px solid #222;
}
.paper-numrow .mono { font-family: var(--font-mono); }
.paper-info {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px 10px; padding: 8px 0 9px;
  font-size: 12px; border-bottom: 1px solid #c4c4c4;
}
.paper-info > div { min-width: 0; display: flex; gap: 2px; line-height: 1.6; }
.paper-info > .pi-line { grid-column: 1 / -1; }
.paper-info .k { flex: 0 0 auto; color: #333; white-space: nowrap; }
.paper-info .v { flex: 1 1 auto; word-break: break-all; }
.paper-rp { font-size: 15px; font-weight: 700; margin: 10px 0 4px; }
.paper-subtitle { margin: 9px 0 4px; font-size: 11.5px; font-weight: 700; }
.paper-rx-note { padding: 10px 0; font-size: 11.5px; color: #555; }
.paper-advice { font-size: 11.5px; line-height: 1.8; margin-top: 7px; }
.paper-amount { margin-top: 9px; text-align: right; font-size: 12px; font-weight: 700; }
.paper-signrow {
  display: flex; flex-wrap: wrap; align-items: flex-end;
  gap: 6px 18px; margin-top: 14px; font-size: 12px; line-height: 1.6;
}
.paper-signrow.second { margin-top: 6px; }
.paper-signrow .sig-item { display: inline-flex; align-items: flex-end; gap: 4px; white-space: nowrap; }
.paper-signrow .sig-item svg { width: 70px; height: 30px; }
.paper-signrow .blank {
  display: inline-block; min-width: 74px; height: 13px;
  border-bottom: 0;
}
.paper-note {
  display: flex; align-items: flex-end; gap: 12px;
  margin-top: 16px; padding-top: 8px; border-top: 1px solid #c4c4c4;
  font-size: 10.5px; color: #333; line-height: 1.75;
}
.paper-note .note-text { flex: 1 1 auto; }
.paper-note .note-date { flex: 0 0 auto; text-align: right; white-space: nowrap; }
.paper-info .pf-v, .paper-field > .pf-v { border-bottom-color: #9a9a94; }

/* A5 默认纸张：字号按参考图比例收紧 */
.paper.a5 { width: 148mm; min-height: 210mm; padding: 10mm 9mm; }
.paper.a5 .paper-hospital { font-size: 19px; padding-top: 13px; }
.paper.a5 .paper-seal { width: 78px; height: 78px; }
.paper.a5 .paper-numrow { font-size: 11.5px; }
.paper.a5 .paper-info { font-size: 11.5px; }
.paper.a5 .rx-paper-table { font-size: 10.5px; }
.paper.a5 .paper-field { font-size: 11.5px; line-height: 1.8; }
.paper.a5 .paper-advice, .paper.a5 .paper-amount, .paper.a5 .paper-signrow { font-size: 11px; }
.paper.a5 .paper-note { font-size: 10px; }

/* 处方表格对齐参考图：首列名称左对齐，其余居中 */
.rx-paper-table { width: 100%; border-collapse: collapse; margin-top: 2px; }
.rx-paper-table th, .rx-paper-table td { border: 1px solid #444; padding: 5px 4px; text-align: center; line-height: 1.5; }
.rx-paper-table th { background: #f1f1f1; font-weight: 700; }
.rx-paper-table td.name { text-align: left; }

/* ==========================================================================
   UI v5｜本轮细节修正
   ========================================================================== */

/* ---------------- 1. 底部菜单：白色通栏、直角 ---------------- */
.app-tabbar {
  padding: 0 0 calc(10px + env(safe-area-inset-bottom));
  background: transparent;
}
.tabbar-inner {
  width: 100%;
  height: 72px;
  padding: 8px 4px 8px;
  border: 0;
  border-top: 1px solid rgba(228, 233, 241, .92);
  border-radius: 0;
  background: #fff;
  box-shadow: 0 -6px 20px rgba(23, 43, 77, .07);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.app-tabbar .tab-item {
  height: 46px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  padding: 4px 0 0;
  border-radius: 12px;
  font-size: 11px;
}
/* 图标统一用 mask：SVG 自带 currentColor，mask 后用 background-color 精准着色 */
.app-tabbar .tab-item .ti-ico {
  width: 25px; height: 25px;
  background-color: #9aa4b2;
  background-image: none;
  -webkit-mask-image: var(--tab-icon, none);
  mask-image: var(--tab-icon, none);
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  opacity: 0.75;
  filter: none;
}
.app-tabbar .tab-item.is-active .ti-ico {
  background-color: var(--color-primary);
  background-image: none;
  -webkit-mask-image: var(--tab-icon, none);
  mask-image: var(--tab-icon, none);
  opacity: 1;
  filter: none;
}
.app-tabbar .tab-item .ti-ico svg { width: 23px; height: 23px; stroke-width: 1.6; }
.app-tabbar .tab-item .ti-label { font-size: 11px; }
.app-tabbar .tab-item.is-active { color: var(--color-primary); }
.app-tabbar .tab-item.is-center { justify-content: flex-end; padding-bottom: 0; }
.app-tabbar .tab-item.is-center .ti-ico {
  top: -26px;
  width: 58px; height: 58px;
  border: 4px solid rgba(255, 255, 255, 0.55);
  background-color: var(--color-primary);
  -webkit-mask-image: none;
  mask-image: none;
  background-image: var(--gradient-brand);
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
  filter: none;
  opacity: 1;
  box-shadow: 0 10px 22px var(--shadow-primary), inset 0 1px 0 rgba(255, 255, 255, .45);
}
.app-tabbar .tab-item.is-center .ti-ico::before {
  content: '';
  position: absolute;
  inset: 0;
  background-color: #fff;
  background-image: none;
  -webkit-mask-image: var(--tab-icon, none);
  mask-image: var(--tab-icon, none);
  -webkit-mask-size: 26px 26px;
  mask-size: 26px 26px;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  filter: none;
}
.app-tabbar .tab-item.is-center .ti-ico svg { width: 27px; height: 27px; }
.tabbar-inner::after {
  bottom: 8px;
  width: 96px;
  height: 4px;
  background: var(--color-primary-soft);
}

/* ---------------- 2. 全局控件圆角：按高度分级 ---------------- */
.input, .select, .textarea,
.m-form .input, .m-form .select, .m-form .textarea,
body[data-mode="form"] .input, body[data-mode="form"] .select, body[data-mode="form"] .textarea,
body[data-mode="form"] .m-form .input,
body[data-mode="form"] .m-form .select,
body[data-mode="form"] .m-form .textarea {
  border-radius: 12px !important;
}
.textarea, .m-form .textarea { border-radius: 12px !important; }
.m-select-field, .m-form .m-select-field { border-radius: 12px !important; }
.m-rx-item .input, .m-rx-item .select { border-radius: 10px !important; }
.m-search .input { border-radius: 999px !important; }
.m-dx-picker-item { border-radius: 10px; }
.segment, .m-form .segment, body[data-mode="form"] .segment { border-radius: 10px !important; }
.segment button, .m-form .segment button { border-radius: 8px; }
.m-pager .select, .m-pager .btn { border-radius: 10px; }
.btn { border-radius: 12px; }
.btn-sm { border-radius: 9px; }

/* 检索列表：每项独立圆角，避免通栏直角行 */
.pick-list { padding: 2px 10px 12px; gap: 6px; }
.pick-item {
  min-height: 62px;
  padding: 11px 13px;
  border-bottom: 0;
  border-radius: 12px;
  background: var(--color-surface-2);
}
.pick-item .pi-main { display: block; }
.pick-item .pi-title { display: block; }
.pick-item .pi-sub { display: block; margin-top: 3px; }
.pick-item .pi-price { font-size: 14px; font-weight: 600; }

/* ---------------- 4. 提交类反馈提示使用主题色 ---------------- */
.toast.is-ok { background: var(--color-primary); }

/* ---------------- 5. 必填星号统一放在文字前面 ---------------- */
.field-label .req,
.rs-label .req { margin: 0 3px 0 0; color: var(--color-block); }

/* ---------------- 6. 价格 / 金额数字与正文同一字体 ---------------- */
.pick-item .pi-price,
.rxd-drug-head span,
.rxd-total b,
.m-money b,
.rx-row-foot .amount,
.rx-total .val {
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

/* ---------------- 7. 列表卡片：紧凑两行信息 + 底部操作 ---------------- */
.m-item-card {
  padding: 12px 14px !important;
  border-radius: 16px !important;
}
.m-item-card .mic-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
}
.m-item-card .mic-main { min-width: 0; }
.m-item-card .mic-title {
  font-size: 15.5px; font-weight: 600; line-height: 1.35;
  color: var(--color-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.m-item-card .mic-title small {
  margin-left: 6px; font-size: 11.5px; font-weight: 400; color: var(--color-muted);
}
.m-item-card .mic-sub {
  margin-top: 3px; font-size: 11.5px; color: var(--color-faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.m-item-card .mic-meta {
  display: flex; align-items: baseline; gap: 6px;
  margin-top: 9px; padding-top: 9px;
  border-top: 1px dashed var(--color-border);
  font-size: 12.5px; line-height: 1.5;
}
.m-item-card .mic-meta .k { flex: 0 0 auto; color: var(--color-faint); }
.m-item-card .mic-meta .v {
  flex: 1 1 auto; min-width: 0; color: var(--color-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.m-item-card .mic-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 10px;
}
.m-item-card .mic-time { font-size: 11.5px; color: var(--color-faint); }
.m-item-card .mic-btns { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.m-item-card .mic-btns .btn {
  min-height: 32px; padding: 0 12px; font-size: 12px; border-radius: 10px;
}
.m-item-card .mic-btns .btn svg { width: 14px; height: 14px; }

@media (max-width: 360px) {
  .app-tabbar .tab-item .ti-label { font-size: 10px; }
  .m-item-card .mic-btns .btn { padding: 0 10px; font-size: 11.5px; }
}

/* ---------------- 二级页面主题色顶栏（参考图 1） ---------------- */
body .app-header.is-hero {
  background: var(--gradient-brand);
  border-bottom: 0;
  color: #fff;
}
body .app-header.is-hero .hd-back {
  color: #fff;
  background: rgba(255, 255, 255, .18);
}
body .app-header.is-hero .hd-back:active { background: rgba(255, 255, 255, .3); }
body .app-header.is-hero .hd-title { color: #fff; font-size: 18px; font-weight: 700; }
body .app-header.is-hero .hd-sub { color: rgba(255, 255, 255, .82); }

/* ---------------- 患者详情基本信息：主题色会员卡 ---------------- */
.m-patient-vip {
  position: relative;
  overflow: hidden;
  border: 0;
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: 0 12px 26px var(--shadow-primary);
}
.m-patient-vip::before,
.m-patient-vip::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, .09);
  pointer-events: none;
}
.m-patient-vip::before { width: 170px; height: 170px; right: -56px; top: -78px; }
.m-patient-vip::after { width: 120px; height: 120px; right: 34px; bottom: -72px; background: rgba(255, 255, 255, .07); }
.m-patient-vip .m-patient-head { position: relative; z-index: 1; }
.m-patient-vip .m-avatar {
  background: rgba(255, 255, 255, .2);
  border: 1px solid rgba(255, 255, 255, .38);
  color: #fff;
}
.m-patient-vip .m-patient-name { color: #fff; font-size: 18px; }
.m-patient-vip .m-patient-name small { color: rgba(255, 255, 255, .85); }
.m-patient-vip .m-patient-sub { color: rgba(255, 255, 255, .78); }
.m-patient-vip .badge.badge-primary,
.m-patient-vip .badge {
  background: rgba(255, 255, 255, .2);
  border-color: rgba(255, 255, 255, .3);
  color: #fff;
}
.m-patient-vip .m-info-grid { position: relative; z-index: 1; }
.m-patient-vip .m-info-item .k { color: rgba(255, 255, 255, .72); }
.m-patient-vip .m-info-item .v { color: #fff; font-weight: 600; }

/* ---------------- 底部菜单中间半圆挖空（参考图 3） ---------------- */
.tabbar-inner { position: relative; }

/* 真实镂空：白色底图用 mask 扣除顶部半圆，非描边/盖色模拟 */
.tabbar-inner {
  border-top: 0;
  background: transparent;
  box-shadow: none;
  filter: drop-shadow(0 -4px 10px rgba(23, 43, 77, .08));
}
.tabbar-inner::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  width: auto;
  height: auto;
  transform: none;
  border-radius: 0;
  background: #fff;
  -webkit-mask: radial-gradient(circle 36px at 50% 10px, transparent 35px, #000 36px);
  mask: radial-gradient(circle 36px at 50% 10px, transparent 35px, #000 36px);
}
.tabbar-inner::after { display: none; }
.app-tabbar .tab-item { position: relative; z-index: 1; }
.app-tabbar .tab-item.is-center .ti-ico {
  border: 4px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 8px 18px var(--shadow-primary), inset 0 1px 0 rgba(255, 255, 255, .45);
}

/* ---------------- 新建处方：西药 / 中药饮片两个独立按钮，取消共用描边框 ---------------- */
#rxType.seg {
  border: 0;
  background: transparent;
  padding: 0;
  gap: 10px;
  border-radius: 0;
}
#rxType.seg .seg-item {
  flex: 1;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--color-text-2);
  box-shadow: none;
}
#rxType.seg .seg-item.is-active {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-weight: 600;
}

/* ---------------- 首页重构：医生白卡 / 宫格白卡 / 接诊看板 / 身份核验 ---------------- */
.m-home { display: flex; flex-direction: column; gap: 14px; margin-top: 0; }
.m-doctor-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px; padding: 16px 14px;
  box-shadow: var(--shadow-card);
}
.m-doctor-card .md-avatar {
  width: 48px; height: 48px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 600; color: #fff;
  background: linear-gradient(145deg, #4a90f5, #1668e3);
  box-shadow: 0 6px 14px rgba(22, 104, 227, .28);
}
.m-doctor-card .md-main { flex: 1; min-width: 0; }
.m-doctor-card .md-name { font-size: 17px; font-weight: 700; color: var(--color-text-1); display: flex; align-items: baseline; gap: 8px; }
.m-doctor-card .md-title { font-size: 12px; font-weight: 400; color: var(--color-text-2); }
.m-doctor-card .md-sub { margin-top: 5px; font-size: 12px; color: var(--color-text-2); display: flex; align-items: center; gap: 5px; }
.m-doctor-card .md-dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; flex: none; }
.m-doctor-card .md-badge {
  flex: none; display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; color: #16a34a; background: #f0fdf4;
  border: 1px solid #bbf7d0; border-radius: 999px; padding: 5px 9px; white-space: nowrap;
}
.m-doctor-card .md-badge svg { width: 13px; height: 13px; }
.m-grid5-wrap {
  background: transparent; border: 0; border-radius: 0;
  padding: 0; box-shadow: none;
}
.m-grid5-wrap .m-grid5 { margin-top: 0; }
.m-grid5-wrap .m-grid5-item { position: relative; }
.m-grid5-wrap .mg-ico { position: relative; }
.mg-badge {
  position: absolute; top: -7px; right: -9px; z-index: 2;
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
  background: #ef4444; color: #fff; font-size: 10px; font-style: normal;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid #fff; box-sizing: content-box;
}
.m-section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 700; color: var(--color-text-1);
  padding: 2px 2px 0;
}
.m-section-title > i { width: 4px; height: 16px; border-radius: 2px; background: var(--color-primary); }
.m-home .m-section-title { margin: 0; padding: 2px 0 0; }
.m-home .m-section-title::before { display: none; }
.m-section-title > svg { width: 16px; height: 16px; margin-left: auto; color: var(--color-text-3); }
.m-stats-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.m-stat {
  display: flex; align-items: center; gap: 9px; text-align: left;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: 14px; padding: 13px 10px; box-shadow: var(--shadow-card);
  cursor: pointer; transition: transform .15s ease;
}
.m-stat:active { transform: scale(.97); }
.m-stat .ms-ico {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
}
.m-stat .ms-ico svg { width: 19px; height: 19px; }
.m-stat .ms-blue { background: #eaf2fe; color: #2f7de1; }
.m-stat .ms-orange { background: #fff4e5; color: #f59e0b; }
.m-stat .ms-green { background: #e8f9f0; color: #10b981; }
.m-stat .ms-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.m-stat .ms-main > span { font-size: 11px; color: var(--color-text-2); white-space: nowrap; }
.m-stat .ms-main > b { font-size: 21px; line-height: 1.1; color: var(--color-text-1); font-weight: 700; }
.m-home .m-face-card { margin-top: 0; }
.m-face-note {
  margin-top: 12px; display: flex; align-items: flex-start; gap: 6px;
  background: var(--color-primary-soft); color: var(--color-primary);
  border-radius: 10px; padding: 10px 12px; font-size: 11px; line-height: 1.6;
}
.m-face-note svg { width: 14px; height: 14px; flex: none; margin-top: 2px; }

/* ===== 患者身份与医保快速核验卡（参考图 2） ===== */
.m-home .m-face-card {
  padding: 0 0 18px;
  overflow: hidden;
  background: linear-gradient(180deg, #f4f9ff 0%, #ffffff 42%, #ffffff 100%);
  border-color: #e3ecf7;
  text-align: left;
}
.m-face-hero {
  position: relative;
  height: 150px;
  background: linear-gradient(180deg, #eaf4ff 0%, #f4f9ff 60%, #ffffff 100%);
  overflow: hidden;
}
.m-face-hero .fh-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center top;
  /* 素材顶部留白已裁掉，放大仅收掉两侧与底部淡色画布 */
  transform: scale(1.12);
  transform-origin: center center;
}
.m-face-hero::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 50px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.85) 70%, #ffffff 100%);
  pointer-events: none;
  z-index: 1;
}
.m-face-title {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding: 4px 18px 0;
  margin-top: -28px;
  position: relative;
  z-index: 2;
  text-align: center;
}
.m-face-title h2 {
  width: 100%;
  text-align: center;
  font-size: 19px;
  font-weight: 700;
  color: #1a2a44;
  letter-spacing: .01em;
}
.m-face-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  background: #e8f9f1;
  border: 1px solid #a7e8c8;
  border-radius: 99px;
  color: #0a9d6a;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.m-face-badge svg { width: 12px; height: 12px; flex: none; }
/* 认证标签置于核验标题正下方，水平居中 */
.m-face-cert { display: flex; justify-content: center; margin-top: 6px; }
.m-face-card .m-face-desc {
  margin: 8px 18px 0;
  max-width: none;
  color: #6b7a90;
  font-size: 13px;
  line-height: 1.6;
}
.m-face-main {
  margin: 14px 18px 0;
  width: calc(100% - 36px);
  box-sizing: border-box;
  min-height: 42px;
  border-radius: 12px;
  background: linear-gradient(120deg, #2f7be8 0%, #3b9bff 55%, #5fb8ff 100%);
  border: 0;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(47, 123, 232, .28);
  letter-spacing: .02em;
}
.m-face-main:hover { filter: brightness(1.05); }
.m-face-main svg { width: 18px; height: 18px; flex: 0 0 18px; }
.m-face-alt {
  display: flex;
  gap: 12px;
  margin: 12px 18px 0;
}
.m-face-alt-btn {
  flex: 1 1 0;
  min-height: 44px;
  border-radius: 12px;
  background: #fff;
  border: 1.5px solid #c9dcff;
  color: #2f5fb8;
  font-size: 14px;
  font-weight: 600;
  box-shadow: none;
}
.m-face-alt-btn:hover { background: #f3f8ff; border-color: #3b7bf7; color: #1f4f9e; }
.m-face-alt-btn svg { width: 17px; height: 17px; flex: 0 0 17px; color: #3b7bf7; }
.m-home .m-face-card .m-face-note {
  margin: 14px 18px 0;
  background: #f1f6ff;
  border: 1px solid #e0ebff;
  color: #4a6b9e;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 11.5px;
  line-height: 1.6;
}
.m-home .m-face-card .m-face-note svg { color: #3b7bf7; }

@media (max-width: 380px) {
  .m-doctor-card .md-badge { display: none; }
  .m-stat { flex-direction: column; align-items: flex-start; gap: 6px; }
}

/* ---------------- 订单/处方/病历等列表卡片：浅冰蓝渐变底（参考图） ---------------- */
.m-item-card {
  background: linear-gradient(150deg, #fbfdff 0%, #f6f9fd 55%, #eff4fa 100%);
  border-color: #e3eaf4;
}

/* ---------------- 8. 药品检索：去除整块白底，每枚药品卡片独立白色 ---------------- */
.modal-body > .pick-list {
  background: transparent;
  padding: 0;
  border-radius: 0;
}
.pick-list { gap: 8px; }
.pick-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: 0 1px 3px rgba(15, 23, 42, .04);
}
/* 分页检索：列表自身滚动，触底加载下一页；状态区承载加载/空态/异常重试 */
.pick-list.is-paged { max-height: calc(100vh - 210px); overflow-y: auto; overscroll-behavior: contain; }
.pick-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--color-faint);
  font-size: var(--fs-xs);
  text-align: center;
}
.pick-state .btn-sm { min-height: 28px; padding: 0 12px; font-size: 12px; }

/* ---------------- 9. 中药饮片行：两列布局，单次数量独占整行以便加长输入框 ---------------- */
.m-rx-item.herb { padding: 10px 12px; }
.herb-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
  margin-top: 8px;
}
.herb-grid .field { gap: 3px; min-width: 0; }
.herb-grid .field-qty { grid-column: 1 / -1; }
.modal-body .m-rx-item.herb .field-label { font-size: 11px; }
/* 表单层用 !important 锁定 16px 字号与 10px 上下内边距，若把高度压到 32px
   会让内容区只剩 10px，生熟/脚注等原生下拉文字被上下裁切。这里用同级优先级
   加高控件并收紧上下内边距，保留 16px 字号以避免 iOS 聚焦缩放。 */
.modal-body .m-rx-item.herb .input,
.modal-body .m-rx-item.herb .select {
  min-height: 48px !important;
  height: 48px !important;
  font-size: 16px !important;
  padding: 8px 10px !important;
}
.modal-body .m-rx-item.herb .select {
  padding-right: 30px !important;
  line-height: normal;
}
.m-rx-item.herb .m-card-foot { margin-top: 8px; padding-top: 8px; }

/* 单次数量：±1 按钮 + 加长的手动输入框，隐藏原生数字上下箭头 */
.qty-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.qty-btn {
  flex: 0 0 44px;
  width: 44px;
  height: 48px;
  min-height: 48px;
  padding: 0;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--r-sm);
  background: var(--color-surface-2);
  color: var(--color-primary);
  font-size: 22px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.qty-btn:active { background: var(--color-primary-soft); }
.qty-stepper .qty-input {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  text-align: center;
  font-variant-numeric: tabular-nums;
  -webkit-appearance: none;
  -moz-appearance: textfield;
  appearance: textfield;
}
.qty-stepper .qty-input::-webkit-outer-spin-button,
.qty-stepper .qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
  display: none;
}

/* 诊疗费步进器：无边框、48px 触控区、固定 5 元步长；减到后台下限后置灰不可点 */
.modal-body .fee-field .fee-stepper {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  min-height: 48px;
}
.modal-body .fee-field .fee-step-btn {
  flex: 0 0 48px;
  width: 48px;
  min-height: 48px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0 !important;
  border-radius: 12px;
  background: var(--color-primary-soft);
  color: var(--color-primary-strong);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 150ms ease-out, transform 150ms ease-out;
}
.modal-body .fee-field .fee-step-btn:hover { background: var(--color-primary-line); }
.modal-body .fee-field .fee-step-btn:active:not(:disabled) {
  transform: scale(0.96);
  background: var(--color-primary-line);
}
.modal-body .fee-field .fee-step-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.modal-body .fee-field .fee-step-btn:disabled {
  background: var(--color-surface-2);
  color: var(--color-faint);
  cursor: not-allowed;
  opacity: 0.75;
}
.modal-body .fee-field .fee-input {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  min-height: 48px;
  height: 48px;
  padding: 0 12px;
  box-sizing: border-box;
  border: 0 !important;
  border-radius: 12px;
  background: var(--color-surface-2) !important;
  box-shadow: none !important;
  outline: none;
  color: var(--color-text);
  font-size: 14px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  -webkit-appearance: none;
  -moz-appearance: textfield;
  appearance: textfield;
}
.modal-body .fee-field .fee-input:focus-visible {
  box-shadow: 0 0 0 2px var(--color-primary-line) !important;
}
.modal-body .fee-field .fee-input::-webkit-outer-spin-button,
.modal-body .fee-field .fee-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
  display: none;
}

/* 添加患者按钮：患者列表与新建处方共用，按钮整体居中 */
.m-add-patient-row {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 2px 0 12px;
}
/* 添加患者按钮：无边框，和页面现有操作按钮（field-link）样式统一 */
.m-add-patient-row .add-patient-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 34px;
  padding: 4px 10px;
  border: 0;
  background: transparent;
}
.m-add-patient-row .add-patient-link svg { width: 16px; height: 16px; }
/* 新增患者页：完全复制参考图样式（遮罩 + 居中弹窗 + 固定按钮区） */
body[data-route="addPatient"] .app-header { display: none !important; }
.ap-modal-root {
  --ap-primary: #3478f6;
  --ap-primary-strong: #2869e8;
  --ap-surface: #fff;
  --ap-field-bg: #f7f9fc;
  --ap-field-border: #e7edf5;
  --ap-line: #f0f2f6;
  --ap-text: #303846;
  --ap-label: #4b5565;
  --ap-placeholder: #9aa7b8;
  --ap-req: #f56c6c;
  --ap-cancel-border: #dbe3ef;
  --ap-radius-modal: 28px;
  --ap-radius-field: 10px;
  --ap-ease: cubic-bezier(.16, 1, .3, 1);
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(38, 48, 64, .34);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-sizing: border-box;
}
.ap-modal {
  /* 宽度不超过 H5 手机容器（.app-shell max-width:480px），预留左右各 12px，与手机视口内表现一致 */
  width: min(456px, 100%);
  max-width: 100%;
  box-sizing: border-box;
  max-height: min(882px, calc(100vh - 48px));
  max-height: min(882px, calc(100dvh - 48px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--ap-surface);
  border-radius: var(--ap-radius-modal);
  box-shadow: 0 24px 64px rgba(24, 39, 75, .22);
  animation: ap-modal-in .28s var(--ap-ease) both;
}
@keyframes ap-modal-in {
  from { opacity: 0; transform: translateY(12px) scale(.985); }
  to { opacity: 1; transform: none; }
}
.ap-modal-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 28px;
  border-bottom: 1px solid var(--ap-line);
}
.ap-modal-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ap-modal-title .ic { width: 22px; height: 22px; color: var(--ap-text); }
.ap-modal-title h2 {
  margin: 0;
  color: var(--ap-text);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
}
.ap-modal-close {
  width: 44px; height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #8a94a4;
  cursor: pointer;
  transition: background .16s ease, color .16s ease;
}
.ap-modal-close:hover { background: var(--ap-field-bg); color: var(--ap-text); }
.ap-modal-close .ic { width: 20px; height: 20px; }
.ap-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 28px 28px 24px;
  scrollbar-width: thin;
  scrollbar-color: #d7deea transparent;
}
.ap-modal-body::-webkit-scrollbar { width: 4px; }
.ap-modal-body::-webkit-scrollbar-thumb { background: #d7deea; border-radius: 4px; }
.ap-form { display: flex; flex-direction: column; gap: 20px; }
body[data-route="addPatient"] .ap-modal .ap-field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
body[data-route="addPatient"] .ap-modal .ap-field .field-label {
  color: var(--ap-label);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}
body[data-route="addPatient"] .ap-modal .ap-field .field-label .req {
  margin: 0 4px 0 0;
  color: var(--ap-req);
  font-weight: 700;
}
.ap-input-shell { display: block; width: 100%; }
body[data-route="addPatient"] .ap-modal .ap-input-shell .input,
body[data-route="addPatient"] .ap-modal .ap-input-shell .select {
  width: 100%;
  height: 52px;
  min-height: 52px;
  margin: 0;
  padding: 0 16px;
  background: var(--ap-field-bg);
  border: 1px solid var(--ap-field-border);
  border-radius: var(--ap-radius-field);
  box-shadow: none;
  color: var(--ap-text);
  font-size: 15px;
  line-height: 52px;
  text-align: left;
  text-align-last: left;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}
/* 覆盖全局下拉箭头：参考图的性别 / 医保类型只显示当前值，不显示箭头 */
body[data-route="addPatient"] .ap-modal .ap-input-shell .select {
  padding-right: 16px !important;
  background-color: var(--ap-field-bg) !important;
  background-image: none !important;
}
body[data-route="addPatient"] .ap-modal .ap-input-shell input[type="number"] { appearance: textfield; -webkit-appearance: textfield; }
body[data-route="addPatient"] .ap-modal .ap-input-shell input::-webkit-outer-spin-button,
body[data-route="addPatient"] .ap-modal .ap-input-shell input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
body[data-route="addPatient"] .ap-modal .ap-input-shell .input::placeholder { color: var(--ap-placeholder); opacity: 1; }
body[data-route="addPatient"] .ap-modal .ap-input-shell .input:focus,
body[data-route="addPatient"] .ap-modal .ap-input-shell .select:focus {
  border-color: var(--ap-primary);
  box-shadow: 0 0 0 3px rgba(52, 120, 246, .14);
  outline: none;
}
.ap-modal-foot {
  flex: none;
  display: flex;
  gap: 16px;
  padding: 16px 28px 28px;
  border-top: 1px solid var(--ap-line);
  background: var(--ap-surface);
}
.ap-btn {
  flex: 1 1 0;
  min-width: 0;
  height: 52px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.ap-btn:active { transform: translateY(1px); }
.ap-btn-cancel {
  border: 1px solid var(--ap-cancel-border);
  background: var(--ap-surface);
  color: var(--ap-text);
}
.ap-btn-cancel:hover { background: var(--ap-field-bg); }
.ap-btn-save {
  border: 1px solid var(--ap-primary);
  background: var(--ap-primary);
  color: #fff;
}
.ap-btn-save:hover { background: var(--ap-primary-strong); border-color: var(--ap-primary-strong); }
.ap-modal button:focus-visible,
.ap-modal input:focus-visible,
.ap-modal select:focus-visible {
  outline: 2px solid var(--ap-primary);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .ap-modal { animation: none; }
  .ap-modal-close, .ap-btn { transition: none; }
}
@media (max-width: 480px) {
  /* 手机端添加患者弹窗拉满视口高度，头尾常驻、表单区滚动 */
  .ap-modal-root { padding: 0; align-items: stretch; }
  .ap-modal {
    width: 100%; max-width: 480px; margin: 0 auto;
    height: 100vh; height: 100dvh;
    max-height: 100vh; max-height: 100dvh;
    border-radius: 20px 20px 0 0;
  }
  .ap-modal-head { min-height: 64px; box-sizing: border-box; padding: 14px 20px; }
  .ap-modal-body {
    padding: 18px 20px 14px;
    overscroll-behavior: contain;
  }
  .ap-modal-foot { padding: 10px 20px calc(12px + env(safe-area-inset-bottom)); }
  .ap-btn { height: 48px; }
  .ap-form { gap: 18px; }
}

/* ---------------- 10. 脱敏字段小眼睛 ---------------- */
.reveal-v { display: inline-flex; align-items: center; gap: 6px; }
.reveal-eye {
  width: 22px; height: 22px; flex: none;
  display: inline-grid; place-items: center;
  background: transparent; border: 0; padding: 0;
  color: var(--color-muted); cursor: pointer;
}
.reveal-eye svg { width: 15px; height: 15px; }
.reveal-eye[data-open="1"] { color: var(--color-primary); }
.m-patient-vip .reveal-eye { color: rgba(255, 255, 255, .85); }
.m-patient-vip .reveal-eye[data-open="1"] { color: #fff; }

/* ---------------- 全局图片底图：顶栏与所有内容页共用一张，无拼接 ---------------- */
body .app-shell {
  background-color: var(--color-bg) !important;
  /* 全站唯一底图来源：电子病历等页面共用，变量在 :root 统一维护 */
  background-image: var(--h5-bg) !important;
  /* 表单页层用 background 简写重置了尺寸/定位/重复，必须用 !important 锁住全局底图口径 */
  background-repeat: no-repeat !important;
  background-position: top center !important;
  background-size: 100% auto !important;
}
body .app-view,
body[data-mode="form"] .app-view {
  background-color: transparent !important;
  background-image: none !important;
}
body .app-header,
body .app-header.is-hero,
body[data-route="inquiry"] .app-header,
body[data-mode="form"] .app-header,
body[data-mode="form"] .app-header.is-hero {
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  background-color: transparent;
  background-image: none;
  border-bottom: 0;
  color: #1b3a6b;
  height: calc(104px + env(safe-area-inset-top, 0px));
  min-height: calc(104px + env(safe-area-inset-top, 0px));
  padding-top: max(54px, env(safe-area-inset-top));
  padding-bottom: 14px;
  box-shadow: none;
}
body .app-header .hd-main { text-align: center; }
body .app-header .hd-title {
  color: #1b3a6b !important;
  font-size: 21px; font-weight: 800; letter-spacing: .02em;
}
body .app-header .hd-sub { color: #5b7290 !important; font-size: 11px; }
body .app-header.is-hero .hd-title { font-size: 18px; font-weight: 700; }
body .app-header .hd-back,
body .app-header.is-hero .hd-back {
  color: #1b3a6b;
  background: rgba(255, 255, 255, .45);
}
body .app-header .hd-back:active,
body .app-header.is-hero .hd-back:active { background: rgba(255, 255, 255, .7); }
body .app-header::after { content: none; }
/* 填写问诊页顶栏与患者详情页同基线：返回按钮与标题沿用全局 8px 内边距 */
body[data-route="inquiryForm"] .app-header {
  position: relative;
  padding-left: 8px;
  padding-right: 8px;
}
/* 顶栏不再叠加渐变遮罩：底图自带柔和过渡 */
body[data-route="inquiryForm"] .app-header .hd-main,
body[data-route="inquiryForm"] .app-header .hd-back { position: relative; z-index: 1; }
/* 填写信息区不再叠多余白底，字段间距与校验保持不变 */
body[data-route="inquiryForm"] #inquiryForm {
  background: transparent !important;
  border: 0 !important;
}
/* 首页标题与下方医生白卡左边线对齐，右侧保留消息和扫码 */
body[data-route="inquiry"] .app-header {
  grid-template-columns: minmax(0, 1fr) auto;
  height: calc(105px + env(safe-area-inset-top, 0px));
  min-height: calc(105px + env(safe-area-inset-top, 0px));
  padding-top: max(75px, env(safe-area-inset-top));
  padding-bottom: 0;
  padding-left: 14px;
  padding-right: 14px;
}
/* 处问诊（开方工作台 consult）标题左对齐；其余所有页面标题居中 */
body[data-route="consult"] .app-header .hd-main { text-align: left; }
body[data-route="inquiry"] .app-header .hd-main { grid-column: 1; text-align: left; }
body[data-route="inquiry"] .app-header .hd-tools { grid-column: 2; }
.hd-tool .hd-scan-img { display: block; width: 24px; height: 24px; }
.hd-tools { grid-column: 3; grid-row: 1; display: flex; align-items: center; gap: 14px; padding-right: 6px; }
.hd-tool {
  position: relative; width: 26px; height: 26px; padding: 0;
  border: 0; background: transparent; color: #1b3a6b; cursor: pointer;
  display: grid; place-items: center;
}
.hd-tool svg.ic, .hd-tool .hd-scan-img { display: block; width: 24px; height: 24px; }
.hd-tool:active { transform: scale(.9); }
.hd-dot {
  position: absolute; top: 1px; right: 2px;
  width: 7px; height: 7px; border-radius: 50%;
  background: #ef4444; border: 1.5px solid #f2f8ff;
}
.hd-notice-item { padding: 10px 2px; border-bottom: 1px solid var(--color-border); }
.hd-notice-item:last-child { border-bottom: 0; }
.hd-notice-item b { font-size: 14px; color: var(--color-text-1); }
.hd-notice-item p { margin: 4px 0; font-size: 12px; color: var(--color-text-2); line-height: 1.6; }
.hd-notice-item span { font-size: 11px; color: var(--color-text-3); }
.hd-notice-empty { padding: 28px 0; text-align: center; color: var(--color-text-3); font-size: 13px; }

/* 轮播图仅展示后台图片，指示条叠加在图片内部底部 */
.m-banner .m-dots {
  position: absolute; left: 50%; bottom: 10px; z-index: 3;
  transform: translateX(-50%); margin: 0; gap: 5px;
}
.m-banner .m-dots i {
  width: 6px; height: 6px; background: rgba(255, 255, 255, .78);
  box-shadow: 0 1px 3px rgba(27, 58, 107, .22);
}
.m-banner .m-dots i.is-active { width: 16px; background: var(--color-primary); }

/* 医生头像：后台上传图片时覆盖文字头像 */
.m-doctor-card .md-avatar.has-img,
.m-profile-head .m-avatar.has-img {
  background: #fff;
  overflow: hidden;
  padding: 0;
  box-shadow: 0 4px 12px rgba(22, 104, 227, .18);
}
.m-doctor-card .md-avatar.has-img img,
.m-profile-head .m-avatar.has-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

/* ==========================================================================
   人脸识别成功反馈弹窗
   ========================================================================== */
.face-feedback .modal-head { display: none; }
.face-feedback .modal {
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(23, 43, 77, .22);
}
.face-feedback .modal-body {
  padding: 26px 20px 20px;
  background: #fff;
}
.ff-close {
  position: absolute; top: 14px; right: 14px; z-index: 5;
  width: 30px; height: 30px; border: 0; border-radius: 50%;
  background: #f0f3f8; color: #8c96a4;
  display: grid; place-items: center; cursor: pointer;
}
.ff-close svg { width: 16px; height: 16px; stroke-width: 2.2; }
.ff-close:active { background: #e2e8f0; }

.ff-ok {
  width: 64px; height: 64px; margin: 4px auto 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #5fd08a, #12995e);
  box-shadow: 0 8px 22px rgba(18, 153, 94, .32), 0 0 0 6px rgba(18, 153, 94, .10);
  display: grid; place-items: center;
  animation: ff-pop .4s cubic-bezier(.2,1.3,.5,1);
}
.ff-ok svg { width: 34px; height: 34px; color: #fff; stroke-width: 3; }
@keyframes ff-pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.ff-title {
  text-align: center;
  font-size: 18px; font-weight: 800; color: #1f2430;
  letter-spacing: .02em;
}
.ff-sub {
  text-align: center;
  font-size: 12.5px; color: #8c96a4;
  margin-top: 6px; line-height: 1.6;
}

.ff-patient {
  margin-top: 18px;
  background: linear-gradient(180deg, #f5f8fd 0%, #eef4fb 100%);
  border: 1px solid #e3ecf7;
  border-radius: 16px;
  padding: 14px;
}
.ff-pt-head {
  display: flex; flex-direction: column; align-items: center;
  gap: 7px; padding: 4px 0 2px;
}
.ff-pt-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, #4f8cff, #2f6df6);
  color: #fff; display: grid; place-items: center;
  flex: 0 0 56px; overflow: hidden;
}
.ff-pt-avatar svg { width: 31px; height: 31px; stroke-width: 1.6; }
.ff-pt-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.ff-pt-name {
  font-size: 18px; font-weight: 700; color: #1f2430;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.ff-pt-badge {
  font-size: 11px; font-weight: 500; color: #5f6b7a;
  background: #fff; border: 1px solid #e3ecf7;
  padding: 2px 9px; border-radius: 999px;
}
.ff-pt-rows {
  margin-top: 12px;
  display: flex; flex-direction: column; gap: 7px;
}
.ff-pt-row {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; line-height: 1.55;
}
.ff-pt-row .k {
  color: #8c96a4; flex: 0 0 94px; white-space: nowrap;
  display: flex; align-items: center; gap: 3px;
}
.ff-pt-row .k svg { flex: 0 0 auto; }
.ff-pt-row .v {
  color: #2c3e50; font-weight: 500;
  flex: 1 1 auto;
}
.ff-pt-row .v.ok { color: #12995e; }
.ff-pt-row .v.warn { color: #d4380d; }
.ff-pt-row .k svg { width: 13px; height: 13px; }
.ff-pt-row .v strong { color: #d4380d; font-weight: 700; }

.ff-btns {
  margin-top: 18px;
  display: flex; flex-direction: column; gap: 10px;
}
.ff-btn {
  width: 100%; min-height: 46px;
  border-radius: 13px;
  font-size: 15px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  border: 0; cursor: pointer;
}
.ff-btn svg { width: 18px; height: 18px; }
.ff-btn-primary {
  background: linear-gradient(135deg, #3a7bff, #2f6df6);
  color: #fff;
  box-shadow: 0 6px 16px rgba(47, 109, 246, .30);
}
.ff-btn-primary:active { transform: scale(.98); }
.ff-btn-ghost {
  background: #fff;
  color: #2f6df6;
  border: 1.5px solid #d6e4ff;
}
.ff-btn-ghost:active { background: #f0f6ff; }

.ff-tip {
  margin-top: 16px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 11px; color: #8c96a4; line-height: 1.5; text-align: center;
}
.ff-tip svg { width: 13px; height: 13px; color: #4f8cff; flex: 0 0 auto; }


/* ---------- 「我的」医生卡片与医生信息弹窗 ---------- */
.m-profile-head.is-clickable { cursor: pointer; }
.m-profile-head.is-clickable:active { filter: brightness(.97); }
.m-doc-more { margin-left: auto; display: inline-flex; align-items: center; color: currentColor; opacity: .72; }
.m-doc-more svg { width: 16px; height: 16px; }

.m-doc { text-align: center; padding: 2px 0 4px; }
.m-doc-avatar {
  width: 72px; height: 72px; margin: 0 auto; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-primary-soft); color: var(--color-primary);
  font-size: 28px; font-weight: 600; overflow: hidden;
  border: 3px solid rgba(255, 255, 255, .9);
  box-shadow: 0 8px 20px rgba(59, 123, 247, .18);
}
.m-doc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.m-doc-name { margin-top: 12px; font-size: 18px; font-weight: 600; color: var(--color-text); }
.m-doc-title { margin-top: 4px; font-size: 12px; color: var(--color-muted); }
.m-doc-badge {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 9px; padding: 3px 10px; border-radius: 999px;
  background: rgba(34, 197, 94, .12); color: #16a34a; font-size: 11px; font-weight: 500;
}
.m-doc-badge svg { width: 12px; height: 12px; }
.m-doc-badge.is-off { background: rgba(148, 163, 184, .16); color: #64748b; }

.m-doc-rows { margin-top: 16px; border-top: 1px solid var(--color-border); text-align: left; }
.m-doc-row {
  display: flex; justify-content: space-between; gap: 14px;
  padding: 11px 2px; border-bottom: 1px solid var(--color-border);
  font-size: 13px; line-height: 1.5;
}
.m-doc-row span { color: var(--color-muted); flex: 0 0 auto; }
.m-doc-row b { font-weight: 500; color: var(--color-text); text-align: right; word-break: break-all; }

.m-doc-sec { margin-top: 16px; text-align: left; }
.m-doc-sec h4 { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--color-text); }
.m-doc-sec p { margin: 0; font-size: 13px; line-height: 1.72; color: var(--color-muted); }

/* ---------- 医保打卡提示弹窗 ---------- */
.m-clock-notice {
  padding: 8px 2px 12px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--color-text);
  text-align: left;
}

/* 居中标题弹窗：关闭按钮绝对定位，保证标题视觉居中 */
.modal-head.is-center { position: relative; justify-content: center; }
.modal-head.is-center .mh-title { text-align: center; }
.modal-head.is-center .mh-close { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }

/* ---------- 标题行筛选下拉：文字与箭头紧凑居中 ---------- */
.m-filter-pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  height: 36px; padding: 0 10px 0 12px; box-sizing: border-box;
  border-radius: var(--r-md); background: var(--color-surface);
  border: 1px solid var(--color-border); flex: 0 0 auto;
}
.m-filter-pill .select {
  appearance: none; -webkit-appearance: none;
  width: auto; min-height: 0; height: 32px; margin: 0; padding: 0;
  border: 0; box-shadow: none; background: transparent;
  font-size: var(--fs-xs); color: var(--color-text); text-align: center;
}
.m-filter-pill > svg { width: 12px; height: 12px; color: var(--color-muted); flex: 0 0 auto; }

/* ---------- 医保凭证扫码 / 身份证读卡 ---------- */
.fa-qr {
  position: relative; width: 220px; height: 220px; margin: 6px auto 16px;
  border-radius: 18px; overflow: hidden; background: #0f1620;
}
.fa-qr video { width: 100%; height: 100%; object-fit: cover; display: block; }
.fa-qr-frame { position: absolute; inset: 16px; }
.fa-qr-frame i { position: absolute; width: 24px; height: 24px; border: 3px solid #fff; }
.fa-qr-frame i:nth-child(1) { left: 0; top: 0; border-right: 0; border-bottom: 0; border-radius: 8px 0 0 0; }
.fa-qr-frame i:nth-child(2) { right: 0; top: 0; border-left: 0; border-bottom: 0; border-radius: 0 8px 0 0; }
.fa-qr-frame i:nth-child(3) { left: 0; bottom: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 8px; }
.fa-qr-frame i:nth-child(4) { right: 0; bottom: 0; border-left: 0; border-top: 0; border-radius: 0 0 8px 0; }
.fa-qr-line {
  position: absolute; left: 16px; right: 16px; top: 16px; height: 2px;
  background: linear-gradient(90deg, transparent, #4ade80, transparent);
  animation: faQrScan 2s linear infinite;
}
@keyframes faQrScan { 0% { transform: translateY(0); } 100% { transform: translateY(186px); } }
.fa-idcard {
  position: relative; width: 220px; height: 138px; margin: 16px auto 20px;
  border-radius: 16px; display: flex; align-items: center; justify-content: center;
  color: #fff; background: linear-gradient(135deg, var(--color-primary), var(--color-primary-strong));
  box-shadow: 0 10px 24px rgba(24, 82, 158, .18);
}
.fa-idcard svg { width: 46px; height: 46px; opacity: .92; }
.fa-idcard-wave {
  position: absolute; inset: 0; border-radius: 16px;
  box-shadow: 0 0 0 0 rgba(24, 82, 158, .35);
  animation: faIdWave 1.8s ease-out infinite;
}
@keyframes faIdWave { 0% { box-shadow: 0 0 0 0 rgba(24, 82, 158, .32); } 100% { box-shadow: 0 0 0 16px rgba(24, 82, 158, 0); } }

/* 筛选胶囊内隐藏原生下拉箭头（基础样式带 !important 背景箭头） */
.m-filter-pill .select { background-image: none !important; background: transparent !important; }
/* 桌面宽屏下弹窗限制在移动端版心内，避免铺满整屏（用左右 0 + auto margin 居中，避免覆盖动画 transform） */
@media (min-width: 521px) {
  .modal:not(.is-fullscreen) { width: 440px; max-width: calc(100vw - 40px); margin: 0 auto; }
  .modal.is-fullscreen {
    left: 0; right: 0; width: 480px; max-width: 100vw;
    margin: 0 auto;
  }
}

/* 列表卡片斑马纹：白色 / 淡蓝交替（蓝色比主题浅底略深，辨识更清晰） */
#recordList > .m-item-card:nth-child(even),
#rxList > .m-item-card:nth-child(even),
#patientList > .m-card:nth-child(even),
.pick-list > .pick-item:nth-child(even),
.m-record-item:nth-child(even) {
  background: #d8e6fb;
}

/* 检索框与列表卡片左右对齐 */
.pick-list { padding: 2px 16px 12px; }
.modal.is-fullscreen .modal-body > .pick-list { padding: 0 16px; }
#recordList > .m-item-card:nth-child(odd),
#rxList > .m-item-card:nth-child(odd) { background: var(--color-surface); }

/* 患者列表卡片：压缩高度，信息项标签与数值同行显示 */
#patientList > .m-card { padding: 11px 14px; }
#patientList .m-card-top { align-items: flex-start; }
#patientList .m-patient-sub { margin-top: 1px; }
#patientList .m-info-grid { margin-top: 7px; gap: 5px 12px; }
#patientList .m-info-item {
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
}
#patientList .m-info-item .k {
  display: inline-block;
  flex: 0 0 auto;
  font-size: 11.5px;
}
#patientList .m-info-item .v {
  display: inline-block;
  flex: 1 1 auto;
  min-width: 0;
  margin-top: 0;
  font-size: 13px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------- 首页「问诊」快捷弹窗 ---------------- */
.qi-form { gap: 0; }
.qi-form > .field { padding: 0 0 14px !important; }
.qi-add-row { display: flex; gap: 8px; }
.qi-add-row .btn { flex: 1 1 0; gap: 6px; }
.qi-add-row .btn svg { width: 15px; height: 15px; }
.qi-form .qi-ta2 { height: 64px; min-height: 64px; resize: none; }
.qi-form .qi-ta3 { height: 92px; min-height: 92px; resize: none; }
.qi-patient-card {
  display: flex; align-items: center; gap: 10px;
  margin-top: 8px; padding: 10px 12px;
  background: var(--color-surface-2);
  border-radius: var(--r-md);
}
.qi-pt-main { flex: 1 1 auto; min-width: 0; }
.qi-pt-name { font-size: 14px; font-weight: 600; }
.qi-pt-name small { margin-left: 6px; font-size: 12px; font-weight: 400; color: var(--color-faint); }
.qi-pt-sub {
  margin-top: 2px; font-size: 11.5px; color: var(--color-faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.qi-pt-ok { display: inline-flex; align-items: center; gap: 3px; flex: 0 0 auto; font-size: 11.5px; color: var(--color-ok, #16a34a); }
.qi-pt-ok svg { width: 13px; height: 13px; }
.qi-form .m-chip-row:empty { display: none; }

/* ---------------- 底部菜单：白色卡片左右通栏贴底 + 开方主按钮加高 ---------------- */
.app-tabbar { padding: 0; }
.tabbar-inner {
  width: 100%;
  height: auto;
  min-height: 82px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  border-radius: 26px 26px 0 0;
}
/* 图标统一按同一可视尺寸裁切，颜色沿用底栏灰/主色，与内置图标保持一致 */
.app-tabbar .tab-item:not(.is-center) .ti-ico {
  -webkit-mask-size: 22px 22px;
  mask-size: 22px 22px;
}
.app-tabbar .tab-item.is-center .ti-ico {
  top: -32px;
  width: 66px; height: 66px;
}
.app-tabbar .tab-item.is-center .ti-ico svg { width: 30px; height: 30px; }
.app-tabbar .tab-item.is-center .ti-ico::before { background-size: 30px 30px; }
.tabbar-inner::after { bottom: calc(6px + env(safe-area-inset-bottom)); }

/* 搜索框：白底弹窗内改用浅灰填充 + 清晰描边，避免边框与背景同色不可见 */
.m-search .input,
.modal-body .m-search .input {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border-strong);
}
.m-search .input:focus,
.modal-body .m-search .input:focus {
  background: #fff;
  border-color: var(--color-primary);
}

/* 列表页顶部：筛选框与新建按钮居中排布 */
.m-page > .m-action-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 4px 0 12px;
}
.m-action-row .btn { flex: 0 0 auto; }
.m-action-row .m-filter-pill { flex: 0 0 auto; }

/* 电子病历 / 电子处方：新建按钮居中、搜索框圆角矩形、筛选文字标签居中 */
.m-page > .m-record-head {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 0 14px;
}
.m-record-head .btn {
  flex: 0 0 auto;
  min-width: 156px;
  justify-content: center;
}
.m-search.m-search-rect .input {
  background: #fff !important;
  border-radius: 14px !important;
}
.m-page > .m-record-tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  margin: 0 0 14px;
}
.m-record-tabs button {
  position: relative;
  padding: 4px 2px 8px;
  border: 0;
  background: transparent;
  color: var(--color-muted);
  font-size: 14px;
}
.m-record-tabs button.is-active {
  color: var(--color-primary);
  font-weight: 600;
}
.m-record-tabs button.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 22px;
  height: 3px;
  border-radius: 3px;
  background: var(--color-primary);
  transform: translateX(-50%);
}

/* 全站图标后台化：上传图片替换内置 SVG 时保持尺寸与自适应 */
:root {
  --h5-select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235f6b7a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}
.select { background-image: var(--h5-select-arrow) !important; }
.ic.ic-img, .gi.gi-img { object-fit: contain; }

/* 新建处方：服用方式标题右侧文字链接 */
.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
#rxUsageWrap .field-label-row .field-label {
  color: var(--form-label, #1d2733);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
}
.field-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 30px;
  padding: 2px 0 2px 8px;
  border: 0;
  background: transparent;
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 600;
}
.field-link .ic { width: 14px; height: 14px; }

/* 新增服用方法：输入框下方的字典同步勾选框，整行居中 */
.usage-sync-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
  color: var(--color-muted);
  font-size: 13px;
  line-height: 1.5;
  cursor: pointer;
}
.usage-sync-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--color-primary);
  cursor: pointer;
}

/* 新建处方：药品类型按钮加宽、间距加大 */
#rxType.segment { gap: 10px; padding: 4px; }
#rxType.segment button {
  min-width: 104px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 9px !important;
}

/* 文章详情：白卡正文，文字段落与图片纵向排列 */
.m-article-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 18px 16px 24px;
  box-shadow: 0 2px 12px rgba(15, 23, 42, .04);
}
.m-article-card h1 { font-size: 20px; line-height: 1.45; color: var(--color-text); margin: 0 0 8px; }
.m-article-meta { font-size: 12px; color: var(--color-faint); margin-bottom: 14px; }
.m-article-summary {
  font-size: 13.5px; color: var(--color-muted); line-height: 1.7;
  background: var(--color-surface-2); border-radius: 10px; padding: 10px 12px; margin-bottom: 16px;
}
.m-article-p { font-size: 15px; line-height: 1.85; color: var(--color-text); margin: 0 0 14px; }
.m-article-img { margin: 0 0 16px; border-radius: 12px; overflow: hidden; background: var(--color-surface-2); }
.m-article-img img { display: block; width: 100%; height: auto; }

/* 全局提示条：成功/警告/错误统一使用主题色底 + 白字 */
.toast,
.toast.is-ok,
.toast.is-warn,
.toast.is-error {
  background: var(--color-primary) !important;
  color: #fff !important;
}

/* 弹窗内检索框（ICD-10 / 药品 / 字典等）：表单页的 .input 右对齐与绿色聚焦底线
   会误命中弹窗输入框，这里单独复位为「文字紧随放大镜左对齐 + 无绿色描边」。 */
.modal-body .m-search .input,
body[data-mode="form"] .modal-body .m-search .input {
  text-align: left !important;
  text-align-last: left !important;
  padding-left: 34px !important;
}
.modal-body .m-search .input:focus,
body[data-mode="form"] .modal-body .m-search .input:focus {
  box-shadow: none !important;
  outline: none !important;
}


/* ==========================================================================
   全局彩色按钮统一：参考图胶囊样式
   蓝色底 #437EFF / 超大圆角 / 白色粗体文字居中 / 无图标
   本层置于所有样式之后，覆盖 upgrade.css、form-pages.css 与旧 v3 定义的
   渐变、10~13px 圆角及硬编码颜色，保证医生端所有彩色按钮视觉一致。
   ========================================================================== */
.btn-primary,
.btn-accent,
.btn-soft,
.btn-ghost,
.btn-danger,
.ff-btn-primary,
.ff-btn-ghost,
.m-face-main,
.m-face-alt-btn,
.segment button.is-active,
body[data-mode="form"] .btn-primary,
body[data-mode="form"] .btn-accent,
body[data-mode="form"] .app-actionbar .btn-accent,
body[data-mode="form"] .btn-soft {
  background: #437eff !important;
  background-image: none !important;
  border: 0 !important;
  border-radius: 999px !important;
  color: #fff !important;
  font-weight: 700 !important;
  text-align: center !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0 !important;
  padding-left: 22px !important;
  padding-right: 22px !important;
  box-shadow: 0 6px 16px rgba(67, 126, 255, .28) !important;
  letter-spacing: .02em !important;
  text-decoration: none !important;
}

/* 禁用态保留可识别的灰底，不与正常胶囊混淆 */
.btn-primary:disabled,
.btn-accent:disabled,
.btn-soft:disabled,
.btn-danger:disabled,
.ff-btn-primary:disabled,
.m-face-main:disabled,
.m-face-alt-btn:disabled {
  background: var(--color-surface-3, #e9edf5) !important;
  color: var(--color-faint, #9aa5b8) !important;
  box-shadow: none !important;
}

/* 兜底：模板若仍残留按钮内图标（含后台上传图标 img），一并隐藏 */
.btn-primary svg,
.btn-primary img.ic,
.btn-accent svg,
.btn-accent img.ic,
.btn-soft svg,
.btn-soft img.ic,
.btn-ghost svg,
.btn-ghost img.ic,
.btn-danger svg,
.btn-danger img.ic,
.ff-btn svg,
.ff-btn img.ic,
.m-face-main svg,
.m-face-main img.ic,
.m-face-alt-btn svg,
.m-face-alt-btn img.ic,
.segment button.is-active svg,
.app-actionbar .btn-accent svg,
.app-actionbar .btn-accent img.ic {
  display: none !important;
}

/* ==================================================================
   新建处方弹窗：西药折叠卡片
   与开方工作台同一套交互——折叠行展示「药名 / 规格 ×数量」+ 右箭头，
   右上角删除；展开后编辑全部字段，保存并收起。控件统一无边框。
   ================================================================== */
.modal-body .rx-fold { margin-bottom: 8px; }
.modal-body .rx-fold-bar {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 46px; padding: 6px 10px; padding-right: 74px;
  background: var(--color-surface-2); border-radius: 10px; cursor: pointer;
  transition: background .15s var(--ease);
}
.modal-body .rx-fold-bar:hover { background: var(--color-surface-3); }
.modal-body .rx-fold-name {
  flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--color-text); font-size: 15px; font-weight: 700;
}
.modal-body .rx-fold-meta {
  display: none; align-items: center; gap: 6px;
  flex: 0 1 auto; min-width: 0; overflow: hidden;
  color: var(--color-muted); font-size: 12px; white-space: nowrap;
}
.modal-body .rx-fold.is-collapsed .rx-fold-meta { display: inline-flex; }
.modal-body .rx-fold-meta > span { max-width: 100px; overflow: hidden; text-overflow: ellipsis; }
.modal-body .rx-fold-dot { flex: 0 0 auto; width: 3px; height: 3px; border-radius: 50%; background: var(--color-faint); }
/* 数量前的乘号：与数字同字号、同色，仅作为连接符 */
.modal-body .rx-fold-times { flex: 0 0 auto; font-size: inherit; line-height: 1; color: inherit; }
.modal-body .rx-fold-arrow {
  position: absolute; right: 40px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 26px; display: grid; place-items: center; color: var(--color-muted);
}
.modal-body .rx-fold-arrow svg { width: 16px; height: 16px; }
.modal-body .rx-fold-del { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.modal-body .rx-fold-body { padding: 6px 2px 2px; }
.modal-body .rx-fold.is-collapsed .rx-fold-body { display: none; }
.modal-body .rx-fold-body .field {
  display: flex; flex-direction: column; align-items: stretch; gap: 3px;
  min-height: 0; padding: 6px 0; border-bottom: 0; background: transparent;
}
.modal-body .rx-fold-body .field > .field-label {
  color: var(--color-faint); font-size: 11px; font-weight: 500; line-height: 1.4;
}
.modal-body .rx-fold-body .grid-2 {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px;
}
/* 第一行：数量 3 位窄框 + 服用方式（与用法用量同款），列间距收紧 */
.modal-body .rx-fold-body .rx-fold-row1 {
  display: grid; grid-template-columns: 84px minmax(0, 1fr); column-gap: 6px;
}
.modal-body .rx-fold-body .drug-num { min-width: 0; }
.modal-body .rx-fold-body .input,
.modal-body .rx-fold-body .select {
  width: 100%; min-height: 42px; height: 42px; padding: 0 12px;
  background: var(--color-surface-2); border: 0 !important; border-radius: 10px;
  box-shadow: none; color: var(--color-text); font-size: 14px;
  text-align: left; text-align-last: left; background-image: none;
}
.modal-body .rx-fold-body .select { padding-right: 26px; }
/* 用法用量下拉：任何状态下保持灰色输入槽底色，选中后不返白 */
.modal-body .rx-fold-body .dose-control .select,
.modal-body .rx-fold-body .dose-control .select:hover,
.modal-body .rx-fold-body .dose-control .select:focus,
.modal-body .rx-fold-body .dose-control .select:active,
.modal-body .rx-fold-body .dose-control .select:valid {
  background-color: var(--color-surface-2) !important;
}
.modal-body .rx-fold-body .input:focus,
.modal-body .rx-fold-body .select:focus {
  background: var(--color-surface-3); box-shadow: none !important; outline: none;
}
/* 数量最多展示 3 位数字，文字居中 */
.modal-body .rx-fold-body .drug-num .input {
  width: 62px; min-width: 62px; max-width: 62px;
  text-align: center !important; text-align-last: center;
  padding: 0 4px;
}
/* 隐藏原生数字上下箭头，与开方工作台一致 */
.modal-body .rx-fold-body input[type="number"] { appearance: textfield; -webkit-appearance: textfield; }
.modal-body .rx-fold-body input::-webkit-outer-spin-button,
.modal-body .rx-fold-body input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.modal-body .rx-fold-body .dose-field:not(.usage-field) { grid-column: 1 / -1; }
.modal-body .rx-fold-body .dose-control { display: flex; align-items: center; gap: 6px; }
.modal-body .rx-fold-body .dose-control .select { flex: 1 1 auto; min-width: 0; }
.modal-body .rx-fold-body .dose-add {
  flex: 0 0 auto; height: 42px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: var(--color-primary-soft); color: var(--color-primary);
  border-radius: 10px; font-size: 13px; cursor: pointer;
}
.modal-body .rx-fold-body .dose-add svg { width: 14px; height: 14px; }
.modal-body .field-label-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.modal-body .fold-link {
  display: inline-flex; align-items: center; gap: 2px;
  color: var(--color-primary); font-size: 11px; cursor: pointer;
}
.modal-body .fold-link svg { width: 12px; height: 12px; }
/* 金额：文字与数字紧贴，位于用法用量下方并与组件左对齐 */
.modal-body .rx-fold-amount {
  display: flex; align-items: baseline; gap: 4px;
  padding: 2px 0 0; color: var(--color-muted); font-size: 12px;
}
.modal-body .rx-fold-amount b { color: var(--color-text); font-size: 14px; font-variant-numeric: tabular-nums; }
.modal-body .rx-fold-foot {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 0 8px; color: var(--color-muted); font-size: 12px;
}
/*【保存并收起】主行动按钮：放大尺寸 + 亮色主题色，点击区域更明确 */
.modal-body .rx-fold-save {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  min-height: 44px; padding: 0 22px;
  border: 0; border-radius: 12px;
  background: var(--color-primary); color: #fff;
  font-size: 14px; font-weight: 600; cursor: pointer;
  box-shadow: 0 6px 14px rgba(59, 123, 247, .22);
  transition: background .15s var(--ease), transform .12s var(--ease);
}
.modal-body .rx-fold-save svg { width: 17px; height: 17px; }
.modal-body .rx-fold-save:hover { background: var(--color-primary-strong); border-radius: 12px; }
.modal-body .rx-fold-save:active { transform: scale(.985); background: var(--color-primary-strong); }

/* ==================================================================
   新建处方弹窗｜中药饮片折叠卡片：第一行三列 / 第二行两列 / 第三行总剂量纯文本。
   炮制规格取饮片目录，特殊煎法与医保审核取后台 optionDicts；无对应项时置灰锁定。
   ================================================================== */
.modal-body .rx-fold-body .herb-fields {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px 8px;
}
.modal-body .rx-fold-body .herb-fields .field { min-width: 0; padding: 6px 0; }
.modal-body .rx-fold-body .herb-processing,
.modal-body .rx-fold-body .herb-dose,
.modal-body .rx-fold-body .herb-times { grid-column: span 2; }
.modal-body .rx-fold-body .herb-decoction,
.modal-body .rx-fold-body .herb-audit { grid-column: span 3; }
/* 总剂量：标签 + 数值同一行，无输入框、无说明文字 */
.modal-body .rx-fold-body .herb-total {
  grid-column: 1 / -1; display: flex !important; flex-direction: row !important;
  align-items: center; gap: 8px; min-height: 32px; padding: 6px 0 0 !important;
}
.modal-body .rx-fold-body .herb-total .field-label { margin: 0; }
.modal-body .rx-fold-body .herb-total-value {
  display: inline-flex; align-items: baseline; gap: 3px;
}
.modal-body .rx-fold-body .herb-total-value b {
  color: var(--color-text); font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.modal-body .rx-fold-body .herb-total-value .unit { color: var(--color-muted); font-size: 12px; }
.modal-body .rx-fold-body select option:disabled {
  color: var(--color-faint); background: var(--color-surface-2); cursor: not-allowed;
}
/* 三个联动下拉：内置箭头、灰底常驻（含选中态）、无边框；炮制规格限宽 4 字 */
.modal-body .rx-fold-body .herb-select,
.modal-body .rx-fold-body .herb-select:hover,
.modal-body .rx-fold-body .herb-select:focus,
.modal-body .rx-fold-body .herb-select:active,
.modal-body .rx-fold-body .herb-select:valid {
  width: 100%; min-height: 42px !important; height: 42px !important;
  padding: 0 26px 0 10px !important; box-sizing: border-box;
  appearance: none; -webkit-appearance: none;
  background-color: var(--color-surface-2) !important;
  background-image: var(--h5-select-arrow) !important;
  background-repeat: no-repeat !important; background-position: right 8px center !important;
  background-size: 14px 14px !important;
  border: 0 !important; border-radius: 10px !important; box-shadow: none !important; outline: none;
  color: var(--color-text) !important; font-size: 13px !important; line-height: normal !important;
  text-align: left !important; text-align-last: left !important;
}
.modal-body .rx-fold-body .herb-processing .herb-select { max-width: 112px; }
.modal-body .rx-fold-body .herb-select:disabled {
  color: var(--color-faint); background-color: var(--color-surface-3) !important; cursor: not-allowed;
}
/* 无步进按钮的数字输入：居中、灰底、单位后缀不抢位 */
.modal-body .rx-fold-body .herb-fields .field-unit { display: flex; align-items: center; gap: 2px; min-width: 0; }
.modal-body .rx-fold-body .herb-fields .field-unit .input {
  flex: 1 1 auto; width: auto; min-width: 0;
  min-height: 42px !important; height: 42px !important; padding: 0 22px 0 6px !important;
  font-size: 13px !important;
  text-align: center !important; text-align-last: center !important;
}
.modal-body .rx-fold-body .herb-fields .field-unit .unit {
  flex: 0 0 auto; color: var(--color-muted); font-size: 11px; white-space: nowrap;
}
/* 开方工作台：表单页层先于本层加载，这里补一次同控件覆盖，避免灰底/箭头被还原 */
body[data-mode="form"] .rx-row-body .herb-fields .herb-select,
body[data-mode="form"] .rx-row-body .herb-fields .herb-select:hover,
body[data-mode="form"] .rx-row-body .herb-fields .herb-select:focus,
body[data-mode="form"] .rx-row-body .herb-fields .herb-select:active,
body[data-mode="form"] .rx-row-body .herb-fields .herb-select:valid {
  min-height: 42px !important; height: 42px !important; padding: 0 26px 0 10px !important;
  background-color: var(--color-surface-2) !important;
  background-image: var(--h5-select-arrow) !important;
  background-repeat: no-repeat !important; background-position: right 8px center !important;
  background-size: 14px 14px !important;
  border: 0 !important; border-radius: var(--r-sm) !important; box-shadow: none !important;
  font-size: 13px !important; text-align: left !important; text-align-last: left !important;
}
body[data-mode="form"] .rx-row-body .herb-fields .field-unit .input {
  min-height: 42px !important; height: 42px !important; padding: 0 22px 0 6px !important;
  font-size: 13px !important;
  text-align: center !important; text-align-last: center !important;
}
body[data-mode="form"] .rx-row-body .herb-fields .herb-total {
  display: flex !important; flex-direction: row !important; align-items: center;
}

/* 服用方式：新增按钮紧跟下拉，与西药用法用量组件一致 */
.modal-body #rxUsageWrap .dose-control { display: flex; align-items: center; gap: 6px; width: 100%; }
.modal-body #rxUsageWrap .dose-control .select {
  flex: 1 1 auto; min-width: 0;
  min-height: 42px !important; height: 42px !important; padding: 0 26px 0 12px !important;
  appearance: none; -webkit-appearance: none;
  background-color: var(--color-surface-2) !important;
  background-image: var(--h5-select-arrow) !important;
  background-repeat: no-repeat !important; background-position: right 10px center !important;
  background-size: 14px 14px !important;
  border: 0 !important; border-radius: 10px !important; box-shadow: none !important; outline: none;
  color: var(--color-text) !important; font-size: 14px !important; line-height: normal !important;
}
.modal-body #rxUsageWrap .dose-control .dose-add {
  flex: 0 0 auto; height: 42px; min-height: 42px; padding: 0 12px;
  border: 0; border-radius: 10px; background: var(--color-primary-soft);
  color: var(--color-primary); font-size: 13px; font-weight: 500; cursor: pointer;
}
