/* 岐黄智诊 · 前端样式 */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.qh-body {
  background: #f2f3f5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #333;
  font-size: 14px;
}
a { color: #16a085; text-decoration: none; }

/* 通用容器 */
.qh-page { padding: 15px; }
.qh-card {
  background: #fff; border-radius: 6px; padding: 15px; margin-bottom: 15px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.qh-title {
  font-size: 16px; font-weight: 600; margin: 0 0 12px;
  padding-left: 9px; border-left: 3px solid #16a085;
}
.qh-sub {
  padding: 10px 12px; font-weight: 600; border-bottom: 1px solid #eee;
  display: flex; justify-content: space-between; align-items: center;
}
.qh-sub .more { font-weight: 400; font-size: 12px; color: #16a085; cursor: pointer; }
.qh-pad { padding: 12px; overflow: auto; flex: 1; }
.qh-form-label { display:inline-block;min-width:64px;color:#fff;font-size:12px;padding-right:4px;text-align:right;vertical-align:middle;}
.qh-muted { color: #999; font-size: 12px; }

/* 统计卡片 */
.qh-stat { display: flex; gap: 12px; flex-wrap: wrap; }
.qh-stat .item { flex: 1; min-width: 150px; background: #fff; border-radius: 6px; padding: 16px; }
.qh-stat .num { font-size: 24px; font-weight: 700; color: #16a085; }
.qh-stat .lbl { color: #888; margin-top: 4px; font-size: 13px; }

/* ===== 语音接诊工作台 ===== */
.qh-wb { display: flex; gap: 12px; height: calc(100vh - 110px); }
.qh-wb .col { background: #fff; border-radius: 6px; display: flex; flex-direction: column; min-height: 0; }
.qh-wb .left { width: 340px; }
.qh-wb .mid { flex: 1; }
.qh-wb .right { width: 380px; }
.qh-caption {
  background: #fafafa; border: 1px solid #eee; border-radius: 6px;
  padding: 10px; height: 200px; overflow: auto; font-size: 14px; line-height: 1.9;
}
.qh-caption .doc { color: #16a085; }
.qh-caption .pat { color: #c0392b; }
.qh-caption .fix { background: #fff3cd; border-bottom: 1px dashed #e0a800; cursor: help; }
.qh-caption .final { color: #2c3e50; }
.qh-caption .interim { color: #95a5a6; font-style: italic; }
.qh-field-btn { margin: 3px 4px 3px 0; }
.qh-field-btn.active { background: #16a085; color: #fff; border-color: #16a085; }
.qh-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #bbb; vertical-align: middle; }
.qh-dot.on { background: #e74c3c; box-shadow: 0 0 7px #e74c3c; }
.qh-level { height: 6px; background: #eee; border-radius: 3px; overflow: hidden; margin-top: 8px; }
.qh-level i { display: block; height: 100%; width: 0; background: #16a085; transition: width .1s; }
.qh-herb { display: flex; gap: 6px; align-items: center; padding: 6px 4px; border-bottom: 1px dashed #eee; }
.qh-herb .name { flex: 1; }
.qh-herb .dose input { width: 64px; }
.qh-warn { color: #e67e22; font-size: 13px; padding: 3px 0; }
.qh-warn.block { color: #c0392b; font-weight: 600; }
.qh-tag { display: inline-block; padding: 1px 8px; border-radius: 10px; background: #e8f6f3; color: #16a085; font-size: 12px; margin: 2px; }
/* 验方库分类快捷标签 */
.qh-cat-chip { display: inline-block; padding: 4px 12px; border-radius: 14px; background: #f2f4f6; color: #555; font-size: 13px; cursor: pointer; user-select: none; border: 1px solid transparent; transition: all .15s; }
.qh-cat-chip:hover { background: #e3f4ef; color: #16a085; }
.qh-cat-chip.active { background: #16a085; color: #fff; border-color: #16a085; }
/* 验方类型徽章 */
.qh-badge { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 12px; }
.qh-badge.c { background: #e6f0ff; color: #2f54eb; }
.qh-badge.p { background: #fff1e6; color: #d4380d; }
.qh-engine { font-size: 12px; color: #888; }
.layui-btn.qh-rec { width: 100%; height: 46px; font-size: 16px; margin-top: 10px; }
.qh-row { display: flex; gap: 8px; flex-wrap: wrap; }
.qh-row > * { flex: 1; }

/* ===== 首页快捷功能工具栏（一键直达中医/西医业务） ===== */
.qh-toolbar {
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  padding: 10px 6px;
  margin-bottom: 15px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0;
  border: 1px solid #eef0f2;
}
.qh-toolbar .tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 6px;
  border-right: 1px solid #eef0f2;
  text-decoration: none;
  color: #555;
  transition: background .15s, transform .15s;
  border-radius: 4px;
  min-height: 78px;
}
.qh-toolbar .tile:last-child { border-right: 0; }
.qh-toolbar .tile:hover {
  background: #f6fbf9;
  color: #16a085;
  transform: translateY(-1px);
}
.qh-toolbar .tile .ico {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 22px;
  color: #fff;
  margin-bottom: 6px;
  font-weight: 700;
  line-height: 1;
}
.qh-toolbar .tile .lbl {
  font-size: 13px;
  color: #444;
  letter-spacing: 0.5px;
}
.qh-toolbar .tile:hover .lbl { color: #16a085; }
.qh-toolbar .tile.disabled {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: none;
}
/* 各图标独立配色，与 WinForms 工具栏视觉对位 */
.qh-toolbar .tile.c-preset   .ico { background: #f39c12; }   /* 处方配置 — 橙黄 */
.qh-toolbar .tile.c-drug     .ico { background: #2980b9; }   /* 药品维护 — 蓝 */
.qh-toolbar .tile.c-tcm      .ico { background: #c0392b; }   /* 中医门诊 — 红 */
.qh-toolbar .tile.c-tcmexp   .ico { background: #8e44ad; }   /* 中医验方 — 紫 */
.qh-toolbar .tile.c-tcmform  .ico { background: #16a085; }   /* 中医方剂 — 青 */
.qh-toolbar .tile.c-western  .ico { background: #27ae60; }   /* 西医门诊 — 绿 */
.qh-toolbar .tile.c-wexp     .ico { background: #d35400; }   /* 西医验方 — 橙 */
.qh-toolbar .tile.c-log      .ico { background: #34495e; }   /* 门诊日志 — 灰蓝 */
@media (max-width: 992px) {
  .qh-toolbar { grid-template-columns: repeat(4, 1fr); }
  .qh-toolbar .tile:nth-child(4n) { border-right: 0; }
}
@media (max-width: 540px) {
  .qh-toolbar { grid-template-columns: repeat(2, 1fr); }
  .qh-toolbar .tile { border-right: 0 !important; border-bottom: 1px solid #eef0f2; }
  .qh-toolbar .tile:nth-last-child(-n+2) { border-bottom: 0; }
}

/* 语音病历开关与问诊引导 */
.qh-switch { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: #666; cursor: pointer; margin-left: 8px; }
.qh-switch input { width: auto; height: auto; vertical-align: middle; }
.qh-guide { background: #f7fbfa; border: 1px solid #d7ece6; border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.qh-guide-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.qh-guide-head b { color: #16a085; font-size: 14px; }
.qh-guide-list { list-style: none; margin: 0; padding: 0; counter-reset: g; }
.qh-guide-list li { position: relative; padding: 7px 8px 7px 34px; border-radius: 6px; margin-bottom: 5px; cursor: pointer; background: #fff; border: 1px solid #eef3f1; font-size: 13px; transition: all .15s; }
.qh-guide-list li:before { counter-increment: g; content: counter(g); position: absolute; left: 7px; top: 8px; width: 20px; height: 20px; line-height: 20px; text-align: center; background: #16a085; color: #fff; border-radius: 50%; font-size: 12px; }
.qh-guide-list li .gp { display: block; color: #888; font-size: 12px; margin-top: 2px; line-height: 1.6; }
.qh-guide-list li.active { background: #eafaf4; border-color: #16a085; box-shadow: 0 0 0 2px rgba(22,160,133,.15); }
.qh-guide-list li.done:before { background: #27ae60; content: '\2713'; }
.qh-guide-list li.done .gl { color: #27ae60; }
.qh-guide-cur { margin-top: 6px; font-size: 12px; color: #16a085; min-height: 16px; }

/* 语音波形占位 */
.qh-mic-bar { display: flex; gap: 3px; align-items: flex-end; height: 36px; }
.qh-mic-bar i { flex: 1; background: #16a085; opacity: .5; border-radius: 2px; height: 10%; transition: height .1s; }

/* ===== 主框架 Shell ===== */
.qh-shell { display: flex; flex-direction: column; height: 100vh; }
.qh-top { height: 52px; background: #16a085; color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; flex: 0 0 auto; }
.qh-logo { font-size: 18px; font-weight: 700; }
.qh-top-r { display: flex; align-items: center; gap: 16px; font-size: 13px; }
.qh-logout { color: #eafff7; }
.qh-main { flex: 1; display: flex; min-height: 0; }
.qh-menu { width: 202px; background: #2c3e50; color: #cfd8dc; overflow: auto; padding: 6px 0; margin: 0; list-style: none; flex: 0 0 auto; }
.qh-menu-title { padding: 10px 16px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.qh-menu-title.qh-link { cursor: pointer; }
/* 含子菜单的标题可点击展开/收起，默认收起 */
.qh-menu-title.qh-parent { cursor: pointer; user-select: none; }
.qh-menu-title.qh-parent::after { content: '▸'; margin-left: auto; font-size: 12px; color: #8aa0a8; transition: transform .15s; }
.qh-menu-item.open > .qh-menu-title.qh-parent::after { transform: rotate(90deg); }
.qh-menu-title.qh-parent:hover, .qh-menu-title.qh-link:hover, .qh-submenu li:hover { background: #1a252f; color: #fff; }
.qh-menu-item.hot > .qh-menu-title { color: #fff7da; }
.qh-menu-item.hot > .qh-menu-title::after { content: '★'; color: #f1c40f; margin-left: auto; font-size: 12px; }
/* 子菜单默认收起（不展开） */
.qh-submenu { list-style: none; margin: 0; padding: 0; background: #243240; max-height: 0; overflow: hidden; transition: max-height .2s ease; }
.qh-menu-item.open > .qh-submenu { max-height: 2000px; }
.qh-submenu li { padding: 8px 16px 8px 34px; font-size: 13px; cursor: pointer; }
.qh-submenu li.active, .qh-menu-title.qh-link.active { background: #16a085; color: #fff; }
.qh-content { flex: 1; min-width: 0; background: #f2f3f5; }
.qh-content iframe { width: 100%; height: 100%; border: 0; display: block; }

/* ===== 登录 ===== */
.qh-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #16a085, #0e6655); }
.qh-login .box { width: 360px; background: #fff; border-radius: 10px; padding: 30px 28px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.qh-login .ttl { text-align: center; font-size: 22px; font-weight: 700; color: #16a085; margin-bottom: 4px; }
.qh-login .sub { text-align: center; color: #999; margin-bottom: 22px; font-size: 13px; }
.qh-login .cap { display: flex; gap: 8px; }
.qh-login .cap img { height: 38px; border-radius: 4px; cursor: pointer; }
.qh-login .tip { margin-top: 14px; font-size: 12px; color: #888; line-height: 1.7; }

/* ===== AI 助手悬浮窗 ===== */
.qh-ai-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 9990;
  background: #16a085; color: #fff; border: 0; border-radius: 24px;
  padding: 11px 20px; font-size: 14px; cursor: pointer; box-shadow: 0 4px 16px rgba(22,160,133,.4);
}
.qh-ai-fab:hover { background: #138d75; }
.qh-aiassist {
  position: fixed; right: 22px; bottom: 72px; z-index: 9991; width: 340px; height: 460px;
  background: #fff; border-radius: 10px; box-shadow: 0 8px 40px rgba(0,0,0,.22);
  display: flex; flex-direction: column; overflow: hidden;
}
.qh-ai-head { background: #16a085; color: #fff; padding: 10px 14px; font-weight: 600; font-size: 14px; }
.qh-ai-msgs { flex: 1; overflow: auto; padding: 12px; background: #f7f9f9; }
.qh-ai-msg { padding: 8px 10px; border-radius: 8px; margin-bottom: 8px; font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.qh-ai-msg.ai-me { background: #d8f3ec; margin-left: 30px; }
.qh-ai-msg.ai-ai { background: #fff; border: 1px solid #e4ebea; margin-right: 14px; }
.qh-ai-msg.ai-sys { background: #eef2f2; color: #666; font-size: 12px; }
.qh-ai-input { border-top: 1px solid #eee; padding: 8px; display: flex; gap: 8px; align-items: flex-end; }
.qh-ai-input textarea { flex: 1; height: 52px; resize: none; border: 1px solid #ddd; border-radius: 6px; padding: 6px; font-size: 13px; }

/* 端标识徽标（服务端 / 医师端 / 收费端 / 挂号端） */
.qh-term { display: inline-block; margin-left: 8px; padding: 1px 8px; font-size: 12px; font-weight: 400;
  color: #fff; background: #16a085; border-radius: 10px; vertical-align: middle; letter-spacing: .5px; }
.qh-logo .qh-term { background: rgba(255,255,255,.22); }

/* ===== 工作台外观弹层 ===== */
.qh-pop {
  position: fixed; right: 22px; top: 70px; z-index: 9990; width: 260px;
  background: #fff; border-radius: 10px; box-shadow: 0 8px 40px rgba(0,0,0,.2);
  overflow: hidden;
}
.qh-pop-t { background: #16a085; color: #fff; padding: 9px 12px; font-weight: 600; font-size: 13px; }
.qh-pop-b { padding: 12px; }
.qh-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.qh-swatches .sw {
  width: 30px; height: 30px; border-radius: 6px; cursor: pointer;
  border: 1px solid #ddd; box-shadow: inset 0 0 0 2px #fff;
}
.qh-swatches .sw:hover { border-color: #16a085; }
.qh-swatches .sw.on { box-shadow: inset 0 0 0 2px #16a085; }
.qh-presc-style select:focus, .qh-presc-style input:focus { outline: none; }

/* ===== 患者照片灯箱 / 对比 ===== */
.qh-lightbox {
  position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,.82);
  display: none; flex-direction: column; padding: 24px;
}
.qh-lightbox.show { display: flex; }
.qh-lightbox-bar { display: flex; align-items: center; gap: 12px; color: #fff; margin-bottom: 12px; }
.qh-lightbox-bar .ttl { font-size: 15px; font-weight: 600; }
.qh-lightbox-body { flex: 1; display: flex; gap: 16px; align-items: center; justify-content: center; overflow: auto; }
.qh-lightbox-body img { max-width: 100%; max-height: 100%; border-radius: 6px; box-shadow: 0 4px 24px rgba(0,0,0,.4); }
.qh-lightbox-body.compare img { max-width: 48%; }
.qh-lightbox .lb-btn { color: #fff; cursor: pointer; background: rgba(255,255,255,.15); padding: 5px 12px; border-radius: 6px; font-size: 13px; }
.qh-lightbox .lb-btn:hover { background: rgba(255,255,255,.3); }
.qh-thumb.on { outline: 3px solid #16a085; outline-offset: 2px; }

/* ============ 响应式 + 触摸适配 ============ */

/* 全局触控优化：去除点击高亮延迟、放大可点目标的命中区域 */
button, a, .qh-sub .more, .qh-submenu li, .qh-menu-title,
.qh-herb, .qh-field-btn, .qh-tag, .qh-thumb, .qh-ai-fab, .lb-btn, .qh-swatches .sw {
  -webkit-tap-highlight-color: rgba(22,160,133,.22);
  touch-action: manipulation;
}
button, .layui-btn, .qh-sub .more, .qh-submenu li, .qh-menu-title,
.qh-herb, .qh-field-btn, .qh-tag, .qh-thumb {
  user-select: none; -webkit-user-select: none;
}

/* 顶部汉堡按钮（默认隐藏，平板/小屏显示） */
.qh-burger { display: none; font-size: 20px; line-height: 1; cursor: pointer; margin-right: 10px; }
.qh-top-l { display: flex; align-items: center; }

/* 侧栏抽屉遮罩 */
.qh-overlay {
  display: none; position: fixed; top: 52px; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.35); z-index: 9970;
}

/* ---- 平板横屏及更小（≤1024）：侧栏抽屉化 + 工作台收窄 ---- */
@media (max-width: 1024px) {
  .qh-burger { display: inline-flex; align-items: center; }
  .qh-menu {
    position: fixed; top: 52px; bottom: 0; left: 0; z-index: 9980; width: 212px;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,.18);
  }
  .qh-shell.menu-open .qh-menu { transform: translateX(0); }
  .qh-shell.menu-open .qh-overlay { display: block; }
  .qh-wb { gap: 10px; }
  .qh-wb .left { width: 280px; }
  .qh-wb .right { width: 300px; }
  .qh-caption { height: 170px; }
}

/* ---- 工作台窄屏堆叠（≤900）：保证中栏不被挤压 ---- */
@media (max-width: 900px) {
  .qh-wb { flex-direction: column; height: auto; }
  .qh-wb .col { width: 100% !important; }
  .qh-wb .left, .qh-wb .right { height: auto; }
  .qh-caption { height: 150px; }
  .qh-pad { max-height: none !important; }
}

/* ---- 竖屏平板 / 大屏手机（≤768）：间距与排版收紧 ---- */
@media (max-width: 768px) {
  .qh-page { padding: 10px; }
  .qh-stat .item { min-width: 46%; }
  .qh-top-r { gap: 10px; font-size: 12px; }
  .qh-login .box { width: 92vw; max-width: 360px; }
  table { font-size: 13px; }
}

/* 更小屏（≤480）：统计卡单行两列、间距收紧 */
@media (max-width: 480px) {
  .qh-stat .item { min-width: 100%; }
  .qh-top-r .qh-engine { display: none; }
}

/* ---- 触摸设备（无 hover）：放大点按目标 + 强化点按反馈 ---- */
@media (hover: none) and (pointer: coarse) {
  .qh-menu-title, .qh-submenu li { min-height: 46px; display: flex; align-items: center; }
  .qh-submenu li { padding-top: 0; padding-bottom: 0; }
  .qh-sub .more { padding: 8px 10px; min-height: 36px; display: inline-flex; align-items: center; }
  .layui-btn { min-height: 40px; }
  .qh-herb { padding: 10px 4px; }
  .qh-herb .dose input { width: 72px; height: 34px; }
  input.layui-input, select.layui-input, textarea.layui-input, .layui-input { min-height: 38px; }
  .qh-field-btn { padding: 8px 12px; }
  /* 触控无 hover，用 :active 给出明确点按反馈 */
  .qh-submenu li:active, .qh-menu-title.qh-link:active,
  .qh-ai-fab:active, .lb-btn:active, .qh-swatches .sw:active,
  .qh-sub .more:active { background: #16a085; color: #fff; }
}

