/* 诊所02 苹果原生小样 · 在 app.css 之上的补充 */
.role-list { display: flex; flex-direction: column; gap: 4px; margin: 4px 0 8px; }
.role-btn {
  width: 100%; min-height: 44px; text-align: left;
  border: 0; background: none; border-radius: var(--r-s);
  padding: 0 12px; display: flex; flex-direction: column; justify-content: center;
}
.role-btn:hover { background: rgba(0,0,0,0.05); }
.role-btn.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.role-btn small { font-size: 13px; color: var(--text-2); font-weight: 400; }
.role-btn.on small { color: var(--accent); opacity: 0.85; }

.mod-note {
  margin: 0 0 16px; padding: 10px 14px;
  background: #f6f6f8; border-radius: var(--r-s);
  font-size: 13px; color: var(--text-2);
}
.mod-note strong { color: var(--text); font-weight: 600; }
.skin-only {
  border: 1px dashed var(--line-strong); border-radius: var(--r-m);
  padding: 16px 20px; margin-top: 16px; color: var(--text-2); font-size: 14px;
}

.table-card { overflow-x: auto; }
.table-card table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table-card th, .table-card td {
  padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table-card th { font-size: 13px; color: var(--text-2); font-weight: 600; }
.table-card td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-card tr:last-child td { border-bottom: 0; }

.flow-steps {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; padding: 0; list-style: none;
}
.flow-steps li {
  min-height: 36px; padding: 6px 12px; border-radius: 18px;
  background: var(--fill); color: var(--text-2); font-size: 13px;
  display: inline-flex; align-items: center;
}
.flow-steps li.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.flow-steps li.done { background: var(--fill); color: var(--text); }
.flow-steps li.done::before { content: "✓ "; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
@media (max-width: 720px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.stat-tile {
  background: var(--surface); border-radius: var(--r-m); box-shadow: var(--sh-1);
  padding: 16px 20px;
}
.stat-tile dt { font-size: 13px; color: var(--text-2); margin: 0; }
.stat-tile dd { margin: 4px 0 0; font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-tile .src { margin-top: 4px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
.sim-receipt {
  margin-top: 12px; padding: 12px 16px; background: #f6f6f8;
  border-radius: var(--r-s); border-left: 3px solid var(--text);
}
.sim-receipt strong { display: block; margin-bottom: 4px; }

.center-home {
  display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 24px; align-items: start;
}
.app.layout-center .center-home { grid-template-columns: 300px minmax(0, 1fr); }
.is-mobile .center-home { grid-template-columns: 1fr; }
.queue-side {
  background: var(--surface); border-radius: var(--r-m); box-shadow: var(--sh-1);
  padding: 16px; position: sticky; top: 0;
}
.queue-side .list-count { margin: 8px 0; }
.hero-center-block {
  background: var(--surface); border-radius: var(--r-l); box-shadow: var(--sh-2);
  padding: 28px 32px 24px;
}
.is-mobile .hero-center-block { padding: 16px; }
.hero-center-block .hero-slot .dock { padding: 0; background: none; }
.hero-center-block .hero-slot .dock-inner { max-width: none; }
.app.hero-mode #dock-home { display: none; }

.tabs-inline { display: flex; gap: 4px; margin: 0 0 16px; background: var(--fill); border-radius: 10px; padding: 2px; }
.tabs-inline button {
  flex: 1; min-height: 40px; border: 0; background: transparent; border-radius: var(--r-s);
  font-size: 14px; color: var(--text);
}
.tabs-inline button.on { background: var(--surface); box-shadow: var(--sh-1); font-weight: 600; }

.block-banner {
  margin: 12px 0; padding: 12px 16px; background: #f6f6f8;
  border-radius: var(--r-s); border-left: 3px solid var(--text);
  font-size: 14px;
}

.sb-groups .sb-item .sb-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px; background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center;
}
.sb-item.on .sb-badge { background: var(--accent); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.is-mobile .field-row { grid-template-columns: 1fr; }

.identity-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px; padding: 10px 14px;
  background: var(--surface); border-radius: var(--r-m); box-shadow: var(--sh-1);
}
.identity-bar select {
  min-height: 40px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface);
}

/* 正式化：隐藏历史模拟角标类；空态不再用警告色边框 */
.sim-tag { display: none !important; }
.empty-mod.skin-only { border-style: solid; border-color: var(--line); color: var(--text-2); }
.mod-note { display: none; }

/* 实验区苹果01 */
.ver-tag {
  font-size: 12px; color: var(--text-2);
  border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 2px 8px; margin-left: 4px;
  white-space: nowrap; align-self: center;
}
.collect-toggle {
  display: flex; align-items: center; gap: 10px;
  min-height: 44px; margin: 12px 0 8px;
}
.collect-toggle input { width: 18px; height: 18px; accent-color: var(--accent); }
.review-list { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.review-item {
  padding: 12px 14px; border-radius: var(--r-s);
  background: var(--fill); border-left: 3px solid var(--line-strong);
}
.review-item.has-conflict { border-left-color: var(--accent); background: var(--accent-soft); }
.review-item .kind { font-size: 13px; font-weight: 600; color: var(--text-2); }
.review-opts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.summary-card .missing { margin-top: 8px; }
.option-on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
#btn-mic.live { background: var(--accent); color: #fff; box-shadow: inset 0 0 0 2px var(--accent); }
.due-flag { color: var(--accent); font-weight: 600; font-size: 13px; }

/* 手机宽度排版修正：两栏改上下堆叠；底栏芯片横滑且不与状态重叠；宽表可横滑 */
html.is-mobile .center-home,
html.is-mobile .app.layout-center .center-home,
.is-mobile .app.layout-center .center-home {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}
html.is-mobile .center-home > *,
html.is-mobile .app.layout-center .center-home > * {
  min-width: 0;
  max-width: 100%;
}
html.is-mobile .queue-side {
  position: static;
  width: 100%;
}
html.is-mobile .center-home .card,
html.is-mobile .center-home .summary-card,
html.is-mobile .center-home-mobile .card,
html.is-mobile .center-home-mobile .summary-card {
  width: 100%;
  max-width: 100%;
}

html.is-mobile .dock-top {
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
}
html.is-mobile .chips {
  flex: 0 1 auto;
  width: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
html.is-mobile .status-wrap {
  flex: none;
  width: auto;
  align-self: center;
}

html.is-mobile .table-card {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
html.is-mobile .table-card table {
  width: max-content;
  min-width: 100%;
}
html.is-mobile .table-card th,
html.is-mobile .table-card td {
  white-space: nowrap;
}

html.is-mobile .tabs-inline {
  overflow-x: auto;
  flex-wrap: nowrap;
}
html.is-mobile .tabs-inline button {
  flex: 0 0 auto;
  padding: 0 12px;
}

html.is-mobile .field-row,
html.is-mobile .grid-2,
html.is-mobile .grid-3 {
  grid-template-columns: minmax(0, 1fr);
}

/* 接诊五步与病历分项来源 */
.flow-track-slot { margin: 0 0 4px; max-width: 760px; }
.flow-track-slot[hidden] { display: none !important; }
.visit-track {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 2px;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: #f2f2f4;
  border-radius: 8px;
  box-sizing: border-box;
}
.visit-track li { margin: 0; flex: 1 1 auto; min-width: max-content; }
.visit-track .track-seg,
.visit-track li button {
  display: block;
  width: 100%;
  min-height: 28px;
  height: 28px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #6e6e73;
  font-size: 12px;
  line-height: 28px;
  font-weight: 500;
  box-shadow: none;
  white-space: nowrap;
}
.visit-track li.on .track-seg,
.visit-track li.on button {
  background: var(--accent-soft, #e8f1ff);
  color: var(--accent, #007aff);
  font-weight: 600;
}
.visit-track li.done:not(.on) .track-seg { color: #86868b; }
.visit-track .tick { font-size: 11px; margin-right: 3px; color: var(--accent, #007aff); }
.visit-track li.locked .track-seg { opacity: 0.42; }
.visit-track li.done button::before { content: none; }
.rec-field { margin-bottom: 16px; }
.rec-field .empty-flag { margin: 0 0 6px; }

.name-link {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.name-link:hover { opacity: 0.8; }

.chk { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 14px; }
.skip-flag { margin: 6px 0; }

.confirm-line {
  border: 1px solid var(--line);
  border-radius: var(--r-m, 12px);
  padding: 12px 14px;
  margin: 10px 0;
  background: #fff;
}
.confirm-line.has-conflict {
  border-color: #c41d3a;
  background: #fff5f5;
}
.confirm-line.has-conflict .conflict { color: #c41d3a; font-weight: 600; }
.confirm-line.is-confirmed { border-color: var(--accent); }
.chk.is-disabled { opacity: 0.55; }
.result-board { display: flex; flex-direction: column; gap: 12px; margin: 12px 0; }
.result-card {
  border: 1px solid var(--line);
  border-radius: var(--r-m, 12px);
  padding: 14px 16px;
  background: #fbfbfd;
}
.result-card h3 { margin: 0 0 8px; font-size: 16px; }
.result-card p { margin: 6px 0; }
.visit-track li.on.done button,
.visit-track li.done.on button { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.suggest-list { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
.suggest-item { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 10px; font-size: 14px; }
.suggest-item:hover { background: var(--accent-soft, #e8f1ff); }
.suggest-item.on { background: var(--accent-soft, #e8f1ff); color: var(--accent, #007aff); box-shadow: inset 0 0 0 1px var(--accent, #007aff); font-weight: 600; }
.mode-seg { display: inline-flex; align-items: center; gap: 0; padding: 2px; margin: 0 0 8px; background: #f2f2f4; border-radius: 8px; }
.mode-seg-btn { height: 28px; padding: 0 12px; border: 0; background: transparent; border-radius: 6px; font-size: 13px; color: #6e6e73; cursor: pointer; }
.mode-seg-btn.on { background: #fff; color: var(--accent, #007aff); font-weight: 600; box-shadow: 0 0 0 0.5px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.06); }
.flow-nav { margin-top: 16px; }
.warn-flag, .update-flag { color: #b42318; }
.hist-prev { margin: 8px 0; padding: 8px 10px; background: #f6f6f8; border-radius: 8px; }
html.is-mobile .main-scroll { padding-bottom: 16px; }

    .ai-guide-slot { margin: 0 0 4px; max-width: 760px; }
.ai-guide-slot[hidden] { display: none !important; }
.ai-guide { margin: 0; font-size: 11px; line-height: 1.3; color: #6e6e73; }
.ai-guide .guide-tag { color: var(--accent, #007aff); font-weight: 600; margin-right: 4px; }
.ai-guide .guide-link {
  display: inline; padding: 0; border: 0; background: none;
  color: var(--accent, #007aff); font: inherit; text-decoration: underline; cursor: pointer;
}


/* 底部工作区压紧：叫下一位、录音、键盘同一排 */
.dock { padding: 4px 24px 10px; }
.dock-top { gap: 6px; margin-bottom: 4px; flex-wrap: nowrap; }
.chips { flex: 0 1 auto; gap: 6px; }
.chip { min-height: 28px; height: 28px; padding: 0 10px; border-radius: 14px; font-size: 12px; }
.status-btn { min-height: 28px; height: 28px; padding: 0 4px; gap: 5px; font-size: 11px; }
.status-text { display: inline-flex; align-items: center; gap: 8px; }
#status-kb { color: var(--text-2); }
.input-bar { min-height: 44px; padding: 4px; border-radius: 22px; }
.mic, .send { width: 36px; height: 36px; }
#ai-input { min-height: 36px; }
.dock-context { font-size: 13px; }
html.is-mobile .dock { padding: 4px 12px 6px; }
html.is-mobile .chip { min-height: 28px; height: 28px; }


.center-home.aux-collapsed { grid-template-columns: minmax(0, 1fr); }
.center-home.aux-collapsed .queue-side { display: none; }
html.is-mobile .center-home.aux-collapsed,
html.is-mobile .app.layout-center .center-home.aux-collapsed { grid-template-columns: minmax(0, 1fr); }
.dock-top[hidden],
.ai-guide-slot[hidden],
.flow-track-slot[hidden],
.aux-handle-slot[hidden] { display: none !important; }
.aux-handle-slot { margin: 0 0 4px; max-width: 760px; }
.aux-handle {
  height: 22px; padding: 0 8px; border: 0; background: #f2f2f4;
  border-radius: 6px; font-size: 11px; line-height: 22px; color: #6e6e73; cursor: pointer;
}
.aux-handle:hover { color: var(--accent, #007aff); background: var(--accent-soft, #e8f1ff); }


#visit-dx-block {
  scroll-margin-top: 72px;
  scroll-margin-bottom: 200px;
}
html.is-mobile #visit-dx-block {
  scroll-margin-top: 60px;
  scroll-margin-bottom: 220px;
}


/* 可编辑控件与已选区域、卡片内语音 */
.edit-ctl, .rec-field textarea, .rec-field input,
#order-suggest, #visit-dx, #fu-new, #fu-note, #fb-note, #pat-note, #fee-remark,
#guest, #slot-name, #tpl-new, #exam-item, #rx, #triage-input, #order-voice-paste {
  width: 100%; min-height: 36px; box-sizing: border-box;
}
.rec-field textarea, #fb-note, #fu-note, #pat-note, #order-voice-paste { min-height: 64px; resize: vertical; }
.empty-flag { cursor: text; color: var(--text-2, #6e6e73); }
.selected-box { margin: 10px 0; padding: 10px 12px; border: 1px solid var(--line, #e5e5ea); border-radius: 12px; background: #fbfbfd; }
.selected-box h3 { margin: 0 0 8px; font-size: 15px; }
.selected-line, .confirm-line { margin: 0 0 10px; padding: 8px 10px; border-radius: 10px; background: #fff; border: 1px solid #ececf0; }
.selected-line.has-conflict, .confirm-line.has-conflict { border-color: #ff3b30; background: #fff5f5; }
.rx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; }
.rx-cell { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: #6e6e73; }
.rx-cell input { min-height: 32px; }
.voice-pane { margin: 8px 0 12px; padding: 12px; border: 1px dashed var(--accent, #007aff); border-radius: 12px; background: #f3f8ff; }
.voice-mic, .voice-stop { min-height: 48px; padding: 0 22px; font-size: 16px; border-radius: 24px; }
.voice-mic[hidden], .voice-stop[hidden], .dock-collapse[hidden] { display: none !important; }
.voice-stop { background: #ff3b30; color: #fff; border: 0; }
.voice-status { margin: 8px 0 4px; font-size: 14px; font-weight: 600; }
.voice-status.live { color: #ff3b30; }
.voice-live { min-height: 44px; padding: 8px 10px; border-radius: 8px; background: #fff; border: 1px solid #d9e6ff; margin-bottom: 8px; }
#order-suggest, #order-selected, #order-voice-pane, #visit-dx { scroll-margin-bottom: 200px; }


/* 全局输入条收起为右下角 AI 助手圆按钮 */
.dock-fab-wrap {
  position: fixed; right: 16px; bottom: 18px; z-index: 45;
  display: flex; align-items: center; gap: 8px;
  pointer-events: none;
}
.dock-fab-wrap[hidden] { display: none !important; }
.dock-fab, .dock-step-chip { pointer-events: auto; }
.dock-fab {
  width: 48px; height: 48px; min-width: 48px; min-height: 48px;
  border: 0; border-radius: 50%;
  background: #1d1d1f; color: #fff;
  font-size: 14px; font-weight: 700; letter-spacing: 0;
  box-shadow: 0 6px 20px rgba(0,0,0,0.22);
  cursor: pointer;
}
.dock-fab:hover { background: #000; }
.dock-step-chip {
  height: 28px; padding: 0 10px; border-radius: 14px;
  border: 1px solid #e5e5ea; background: rgba(255,255,255,0.96);
  font-size: 12px; color: #3a3a3c; cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
  white-space: nowrap;
}
.dock-collapse {
  flex: none; height: 28px; padding: 0 10px; margin-right: 4px;
  border: 0; border-radius: 14px; background: #f2f2f4;
  font-size: 12px; color: #6e6e73; cursor: pointer;
}
html.dock-collapsed #dock {
  opacity: 0; transform: translateY(16px);
  pointer-events: none; visibility: hidden;
  max-height: 0; padding-top: 0; padding-bottom: 0; margin: 0;
  transition: opacity 200ms ease, transform 200ms ease, max-height 200ms ease;
}
html.dock-open #dock {
  opacity: 1; transform: none; visibility: visible;
  transition: opacity 200ms ease, transform 200ms ease;
}
html.dock-collapsed #dock-home {
  min-height: 0; height: 0; padding: 0; overflow: hidden;
  pointer-events: none;
}
html.is-mobile .dock-fab-wrap { right: 12px; bottom: 72px; }
html.is-mobile .dock-fab { width: 48px; height: 48px; }


/* 输入框至少 16px，避免 iOS 聚焦时整页放大；保证可点可选 */
.field input, .field textarea, .edit-ctl, #order-suggest, #visit-dx, #fu-new, #ai-input {
  font-size: 16px;
  -webkit-user-select: text;
  user-select: text;
}


.dx-box #visit-dx, .dx-box #fld-diagnosis { font-size: 16px; }
.dx-picked { margin: 10px 0; padding: 10px 12px; border: 1px solid var(--line, #e5e5ea); border-radius: 12px; background: #fbfbfd; }
.dx-picked h3 { margin: 0 0 8px; font-size: 15px; }
.dx-picked-row { margin: 0 0 8px; padding: 8px 10px; border-radius: 10px; background: #fff; border: 1px solid #ececf0; }
.dx-suggest .suggest-item { font-size: 16px; text-align: left; width: 100%; }
