/* ===== 患者预约管理系统 · 样式 ===== */
:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --line: #e4e9f0;
  --line-strong: #d3dae5;
  --text: #101828;
  --muted: #667085;
  --muted-2: #98a2b3;

  --primary: #0e7490;
  --primary-dark: #155e75;
  --primary-soft: #e7f4f8;

  --green: #15803d;
  --green-bg: #dcfce7;
  --amber: #b45309;
  --amber-bg: #fef3c7;
  --red: #b91c1c;
  --red-bg: #fee2e2;
  --gray: #475569;
  --gray-bg: #eef2f6;

  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow: 0 2px 6px rgba(16, 24, 40, 0.06), 0 12px 28px rgba(16, 24, 40, 0.08);

  /* 内容聚焦：正文最大宽度（超过后居中留白，避免一行文字横跨整屏） */
  --content-max: 1180px;
  --page-pad: 26px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; }

button { font-family: inherit; font-size: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; }
/* 手机上长按要能选中、能复制：输入框一律放开文本选择与长按菜单
   （部分安卓浏览器/输入法会把可编辑区域的选择菜单吃掉，这里显式声明一次） */
input, textarea, select { -webkit-user-select: text; user-select: text; }
input, textarea { -webkit-touch-callout: default; }

[hidden] { display: none !important; }

/* ---------- 启动态 ---------- */
.boot {
  display: flex; align-items: center; justify-content: center;
  height: 100vh; color: var(--muted); gap: 10px;
}
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--line-strong); border-top-color: var(--primary);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 通用组件 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line-strong);
  background: #fff; color: var(--text);
  padding: 8px 14px; border-radius: 8px;
  font-weight: 500; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { background: #f8fafc; border-color: #c3ccda; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-ghost { background: var(--primary-soft); border-color: #bfe0ea; color: var(--primary-dark); }
.btn-ghost:hover { background: #d9edf4; }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { background: #12652f; border-color: #12652f; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #991b1b; border-color: #991b1b; }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 7px; }
.btn-block { width: 100%; padding: 10px; }
.btn-link {
  background: none; border: none; color: var(--primary); padding: 4px 2px;
  text-decoration: underline; text-underline-offset: 3px;
}

.alert { border-radius: 8px; padding: 9px 12px; font-size: 13px; margin: 10px 0; }
.alert-error { background: var(--red-bg); color: var(--red); border: 1px solid #fecaca; }
.alert-info { background: var(--primary-soft); color: var(--primary-dark); border: 1px solid #cbe6ee; }

/* ---------- 重复登记提示（登记弹窗顶部的查重条） ---------- */
.dup-card {
  margin: 0 0 12px; padding: 10px 12px;
  border: 1px solid #f3d9a4; border-radius: 9px;
  background: linear-gradient(180deg, #fffbf2 0%, #fdf4e3 100%);
}
.dup-card.forced { border-color: #d7dde7; background: #f8fafc; }
.dup-head { font-size: 13px; font-weight: 700; color: #92400e; margin-bottom: 4px; }
.dup-card.forced .dup-head { color: #475569; }
.dup-body { font-size: 12.5px; color: #475569; line-height: 1.65; }
.dup-body b { color: #1f2937; font-weight: 600; }
.dup-warn { color: #b45309; font-weight: 600; }
.dup-link {
  margin-top: 6px; padding: 0; border: none; background: none; cursor: pointer;
  font-family: inherit; font-size: 12px; color: var(--primary);
  text-decoration: underline; text-underline-offset: 2px;
}
.dup-link:hover { color: var(--primary-dark); }
/* 详情页顶部的「多客服跟进」提示 */
.multi-alert b { font-weight: 700; }
/* 咨询记录时间线：比预约/回访记录紧一点，条数可能较多 */
.consult-tl .tl-item { padding-bottom: 9px; }
.consult-tl .tl-body { line-height: 1.6; }

.tag {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 500; line-height: 18px; white-space: nowrap;
}
.tag-pending { background: var(--amber-bg); color: var(--amber); }
.tag-visited { background: var(--green-bg); color: var(--green); }
.tag-noshow { background: var(--red-bg); color: var(--red); }
.tag-new { background: var(--primary-soft); color: var(--primary-dark); }
.tag-following { background: #fef0e6; color: #c2410c; }
.tag-closed, .tag-cancelled { background: var(--gray-bg); color: var(--gray); }
/* 咨询记录：渠道灰 / 首次登记青 / 再次咨询紫 */
.tag-gray { background: var(--gray-bg); color: var(--gray); }
.tag-first { background: var(--primary-soft); color: var(--primary-dark); }
.tag-consult { background: #ede9fe; color: #6d28d9; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 32px 16px;
  background:
    radial-gradient(900px 420px at 12% -10%, #e2f1f6 0%, rgba(226, 241, 246, 0) 60%),
    radial-gradient(760px 380px at 96% 6%, #e8f6f2 0%, rgba(232, 246, 242, 0) 62%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 420px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 30px 28px 26px;
}
.login-brand { text-align: center; margin-bottom: 20px; }
.login-brand .logo {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary-dark);
  font-size: 12px; font-weight: 600; letter-spacing: .04em;
}
.login-brand h1 { font-size: 21px; margin: 12px 0 5px; }
.login-brand .sub { color: var(--muted); font-size: 13px; margin: 0; }

.login-form label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 5px; }
.login-form input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong);
  border-radius: 8px; background: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.login-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14, 116, 144, .12); }
.login-form .row { display: flex; gap: 8px; }
.login-form .row input { flex: 1; }
.login-form .btn-block { margin-top: 20px; }
.field-error { color: var(--red); font-size: 12px; min-height: 16px; margin-top: 4px; }
.hint { color: var(--muted-2); font-size: 12.5px; text-align: center; margin: 14px 0 0; }
.subtab { display: flex; gap: 16px; margin-bottom: 4px; }
.subtab-btn {
  border: none; background: none; padding: 2px 0; color: var(--muted);
  border-bottom: 2px solid transparent; font-weight: 500;
}
.subtab-btn.active { color: var(--primary-dark); border-bottom-color: var(--primary); }

/* 记住登录状态（勾选框要压掉 .login-form input 的输入框样式） */
.login-form .remember {
  display: flex; align-items: center; gap: 7px;
  margin: 13px 0 0; font-size: 13px; color: var(--muted); cursor: pointer;
}
.login-form .remember input {
  width: 15px; height: 15px; min-height: 0; padding: 0; margin: 0;
  border: 0; background: none; box-shadow: none;
  accent-color: var(--primary); flex: 0 0 auto;
}
.login-form .remember span { line-height: 1.35; }

/* 登录卡片底部辅助链接（忘记密码 / 返回登录） */
.login-links { display: flex; justify-content: center; gap: 22px; margin-top: 10px; }
.link-btn {
  border: none; background: none; padding: 0; cursor: pointer;
  color: var(--primary-dark); font-size: 12.5px;
  text-decoration: underline; text-underline-offset: 2px;
}
.link-btn:hover { color: var(--primary); }

/* ---------- 应用框架 ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 224px; flex: 0 0 224px; background: var(--panel);
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.side-head { padding: 16px 16px 13px; border-bottom: 1px solid var(--line); }
.side-head .org { font-size: 12px; color: var(--primary-dark); background: var(--primary-soft);
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-weight: 600; }
.side-head h2 { font-size: 15px; margin-top: 7px; }
/* 导航紧接头部，不撑满高度；余下空间自然留白在底部 */
.side-nav { padding: 10px 9px 4px; flex: 0 0 auto; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  border: none; background: transparent; color: var(--text);
  padding: 8px 11px; border-radius: 8px; margin-bottom: 2px;
  text-align: left; font-weight: 500;
}
.nav-item:hover { background: #f4f8fa; }
.nav-item.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.nav-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .5; }
.nav-item.active .nav-dot { opacity: 1; }
.nav-badge {
  margin-left: auto; background: var(--red); color: #fff;
  font-size: 11px; font-weight: 600; min-width: 19px; height: 19px;
  border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px;
}
.side-foot { border-top: 1px solid var(--line); padding: 11px 13px; margin-top: auto; }

/* 版本行：只用于确认「现在打开的是不是最新页面」，不抢视觉 */
.ver-line {
  font-size: 11px; color: var(--muted-2); letter-spacing: .02em;
  margin-bottom: 8px; line-height: 1.4;
}
.ver-line:empty { display: none; }

/* 侧栏速览：今日工作焦点，填补导航与用户区之间的空白 */
.side-brief { padding: 12px 13px 0; margin-top: 6px; border-top: 1px solid var(--line); }
.side-brief:empty { display: none; border-top: none; }
.side-brief .brief-title {
  font-size: 11.5px; color: var(--muted-2); letter-spacing: .05em;
  margin-bottom: 6px; font-weight: 600;
}
.side-brief .brief-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 9px; border-radius: 7px; margin-bottom: 3px;
  font-size: 13px; cursor: pointer; border: 1px solid transparent;
}
.side-brief .brief-row:hover { background: #f4f8fa; border-color: var(--line); }
.side-brief .brief-row .n {
  margin-left: auto; font-weight: 700; font-size: 13.5px;
  font-variant-numeric: tabular-nums; color: var(--muted);
}
.side-brief .brief-row.hot .n { color: var(--red); }
.side-brief .brief-row .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .45; flex: 0 0 6px; }
.side-brief .brief-row.hot { color: #b45309; }
.side-brief .brief-row.hot .dot { opacity: 1; }
.user-box { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: 0 0 32px;
  background: var(--primary); color: #fff; display: flex; align-items: center;
  justify-content: center; font-size: 13px; font-weight: 600;
}
.user-meta { min-width: 0; flex: 1; }
.user-meta .name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta .phone { font-size: 12px; color: var(--muted-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .foot-actions { display: flex; gap: 6px; margin-top: 10px; }
.side-foot .foot-actions .btn { flex: 1; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------- 体验模式提示条 ---------- */
.local-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px var(--page-pad); font-size: 13px; line-height: 1.5;
  background: #fff8e6; color: #7a4b00; border-bottom: 1px solid #f0dcae;
}
.local-banner[hidden] { display: none; }
.local-dot { width: 8px; height: 8px; border-radius: 50%; background: #d98a00; flex: 0 0 8px; }
.local-banner .spacer { flex: 1 1 auto; }
.local-banner b { color: #a35c00; }
/* 提示条内容与正文同宽，避免在宽屏上被拉散 */
.local-banner > .local-inner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  width: 100%; max-width: var(--content-max); margin: 0 auto;
}
@media (max-width: 720px) {
  .local-banner { padding: 8px 14px; font-size: 12.5px; }
}

/* ---------- 装到手机桌面（PWA） ---------- */
/* 登录卡片底部：一直可点，不打扰 */
.install-row { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); text-align: center; }
.install-row[hidden] { display: none; }
.install-btn {
  width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 14px; border-radius: 10px; cursor: pointer; font-family: inherit;
  border: 1px solid #b6e0ea; background: linear-gradient(180deg, #f3fbfd, #e7f6fa);
  color: #0b5d73; font-size: 14px; font-weight: 600;
}
.install-btn:hover { border-color: #7fcadd; background: #e3f5fa; }
.install-btn:active { transform: translateY(1px); }
.install-ico { font-size: 16px; line-height: 1; }
.install-note { margin-top: 7px; font-size: 11.5px; line-height: 1.55; color: var(--muted); }

/* 工作台顶上的一条提醒（可关闭，关过就不再烦） */
.install-banner { background: #eefafd; border-bottom: 1px solid #bfe6ef; }
.install-banner[hidden] { display: none; }
.install-banner-inner {
  display: flex; align-items: center; gap: 10px;
  width: 100%; max-width: var(--content-max); margin: 0 auto;
  padding: 8px var(--page-pad); font-size: 13px; color: #0b5d73;
}
.install-banner .ib-ico { font-size: 15px; line-height: 1; }
.install-banner .ib-txt { line-height: 1.45; }
.install-banner .spacer { flex: 1 1 auto; }
.ib-close {
  border: none; background: none; cursor: pointer; font-size: 18px; line-height: 1;
  color: #6b8f99; padding: 2px 5px; border-radius: 6px;
}
.ib-close:hover { background: #d9f1f7; color: #0b5d73; }
@media (max-width: 720px) {
  .install-banner-inner { padding: 8px 14px; font-size: 12.5px; flex-wrap: wrap; }
  .install-banner .ib-txt { flex: 1 1 150px; }
}

/* 安装指引弹窗 */
.install-guide { font-size: 13.5px; line-height: 1.7; }
.ig-lead { margin: 0 0 8px; }
.ig-steps { margin: 0 0 10px; padding-left: 20px; }
.ig-steps li { margin-bottom: 6px; }
.ig-tip {
  margin: 0; padding: 9px 11px; background: #f4f7f9; border-radius: 8px;
  font-size: 12.5px; line-height: 1.65; color: #52616b;
}
.ig-emoji { font-size: 14px; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px var(--page-pad); background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
/* 顶栏内部同样收敛到正文宽度并对齐 */
.topbar > .topbar-inner {
  display: flex; align-items: center; gap: 14px;
  width: 100%; max-width: var(--content-max); margin: 0 auto;
}
.topbar h1 { font-size: 18px; }
.topbar .spacer { flex: 1; }
.topbar .today { color: var(--muted); font-size: 13px; }
/* 顶栏「← 返回」只在窄屏（侧栏导航收起成横排）时出现 */
.topbar-back { display: none; flex: 0 0 auto; padding: 5px 10px; }

/* 内容聚焦：正文居中并限制最大宽度 */
.content { padding: 16px var(--page-pad) 24px; flex: 1; }
.content > .content-inner { width: 100%; max-width: var(--content-max); margin: 0 auto; }

/* ---------- 卡片 / 统计 ---------- */
/* 统计卡：内容只有数字，固定较窄宽度并靠左排布，不横铺整屏 */
.stat-grid {
  display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px;
}
.stat-card {
  flex: 0 1 190px; min-width: 150px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 11px 14px; box-shadow: var(--shadow-sm); cursor: pointer;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.stat-card:hover { border-color: #cbe6ee; transform: translateY(-1px); box-shadow: var(--shadow); }
.stat-card .label { color: var(--muted); font-size: 12.5px; }
.stat-card .value { font-size: 24px; font-weight: 700; margin-top: 1px; letter-spacing: -.02em; }
.stat-card .value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.stat-card.accent-amber .value { color: var(--amber); }
.stat-card.accent-green .value { color: var(--green); }
.stat-card.accent-blue .value { color: var(--primary); }

/* ---------- 本月消费汇总（工作台统计卡下方一条）---------- */
.month-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px;
  margin-bottom: 12px; padding: 10px 16px;
  background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--primary); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.month-bar .mb-head { flex: 0 0 auto; display: flex; flex-direction: column; gap: 1px; }
.month-bar .mb-title { font-size: 13px; font-weight: 700; color: var(--text); }
.month-bar .mb-sub { font-size: 11.5px; color: var(--muted-2); white-space: nowrap; }
.month-bar .mb-items { flex: 1 1 auto; display: flex; flex-wrap: wrap; gap: 8px; }
.month-bar .mb-item {
  flex: 1 1 150px; min-width: 0;
  display: flex; flex-direction: column; gap: 0;
  padding: 5px 12px; border-radius: 8px;
  background: #f7fafb; border: 1px solid var(--line);
}
.month-bar .mb-k { font-size: 11.5px; color: var(--muted); }
.month-bar .mb-v {
  font-size: 18px; font-weight: 700; letter-spacing: -.01em;
  color: var(--text); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.month-bar .mb-v small { font-size: 12px; font-weight: 600; margin-right: 1px; color: var(--muted); }
.month-bar .mb-x { font-size: 11px; color: var(--muted-2); }
.month-bar .mb-out .mb-v { color: var(--primary-dark); }
.month-bar .mb-adm .mb-v { color: #7e22ce; }
/* 金额为 0 时收敛成灰色：不要用「有钱」的强调色喊一个零 */
.month-bar .mb-v.zero { color: var(--muted-2); }
.month-bar .mb-total {
  background: var(--amber-bg); border-color: #fde68a;
}
.month-bar .mb-total .mb-v { color: #92400e; }
.month-bar .mb-total .mb-k { color: #92400e; opacity: .85; }
/* 区间选择：预设胶囊 + 两个日期框（右上角，默认「本月」） */
.month-bar .mb-pick {
  flex: 0 0 auto; margin-left: auto;
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
}
.month-bar .mb-chips { display: flex; gap: 4px; }
.month-bar .mb-chip {
  font: inherit; font-size: 11.5px; line-height: 1;
  padding: 4px 9px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  transition: color .12s, border-color .12s, background .12s;
}
.month-bar .mb-chip:hover { border-color: var(--primary); color: var(--primary-dark); }
.month-bar .mb-chip.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.month-bar .mb-dates { display: flex; align-items: center; gap: 4px; }
.month-bar .mb-dates input[type="date"] {
  font: inherit; font-size: 11.5px; color: var(--text);
  padding: 3px 5px; border: 1px solid var(--line); border-radius: 6px; background: #fff;
  font-variant-numeric: tabular-nums;
}
.month-bar .mb-dates input[type="date"]:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(14, 116, 144, .12);
}
.month-bar .mb-dash { font-size: 11px; color: var(--muted-2); }
@media (max-width: 860px) {
  .month-bar { padding: 10px 12px; gap: 8px; }
  .month-bar .mb-head { flex: 1 1 100%; flex-direction: row; align-items: baseline; gap: 8px; }
  .month-bar .mb-item { flex: 1 1 calc(50% - 4px); padding: 5px 9px; }
  .month-bar .mb-v { font-size: 16px; }
  .month-bar .mb-sub { white-space: normal; }
  /* 窄屏：预设与日期上下叠，日期框各占一半，整条不横向溢出 */
  .month-bar .mb-pick {
    flex: 1 1 100%; margin-left: 0; flex-direction: column;
    align-items: stretch; gap: 6px;
  }
  .month-bar .mb-chips { justify-content: space-between; }
  .month-bar .mb-chip { flex: 1 1 0; text-align: center; padding: 5px 6px; }
  .month-bar .mb-dates { justify-content: space-between; }
  .month-bar .mb-dates input[type="date"] { flex: 1 1 0; min-width: 0; }
}

/* ---------- 渠道统计（工作台）---------- */
.chan-panel { margin-bottom: 12px; }
.chan-total { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.chan-total b { color: var(--primary-dark); font-size: 13.5px; }

.chan-cards { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 16px 4px; }
.chan-card {
  flex: 1 1 150px; min-width: 142px;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 13px 10px; background: #fcfdfe;
}
.chan-card .ch-name {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--muted); font-weight: 500;
}
.chan-card .ch-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); flex: 0 0 auto; }
.chan-card .ch-main {
  font-size: 23px; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; color: var(--text); margin-top: 1px;
}
.chan-card .ch-main small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.chan-card .ch-sub {
  display: flex; flex-wrap: wrap; gap: 4px 10px;
  font-size: 12px; color: var(--muted-2); margin-top: 2px;
}
.chan-card .ch-sub b { color: #344054; font-weight: 600; }
.chan-card .ch-rate { color: var(--muted); }
/* 卡内迷你双线：只留「到诊」一组，本期累计（实线）vs 上期同期（灰虚线），横轴为整月 */
.chan-card .ch-cmp-block { margin-top: 9px; }
.ch-spark-head {
  display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--muted-2);
}
/* 指标小标签：颜色与对应折线一致，一眼分得清哪条是登记、哪条是到诊 */
.ch-k {
  display: inline-block; flex: 0 0 auto;
  font-size: 10.5px; font-weight: 600; line-height: 16px;
  color: #fff; padding: 0 5px; border-radius: 4px;
  letter-spacing: .02em;
}
.chan-card .ch-cmp-txt b { color: #475467; font-weight: 600; }
.ch-cmp-none { margin-left: auto; color: var(--muted-2); }
.chan-card .ch-spark { margin-top: 4px; }
.chan-card .ch-spark svg { display: block; width: 100%; height: 44px; }
.chan-card .ch-cmp {
  display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--muted-2); margin-top: 3px;
}
.chan-card .ch-cmp b { color: #475467; font-weight: 600; }
.chan-card .ch-cmp.muted { color: var(--muted-2); }
.ch-delta { margin-left: auto; font-weight: 600; }
.ch-delta.up { color: #15803d; }
.ch-delta.down { color: #b91c1c; }
.ch-delta.flat { color: var(--muted); }

/* 各渠道用一点色差，扫一眼就能区分（不依赖颜色传达信息） */
.chan-c0 .ch-dot { background: #2f80ed; }
.chan-c1 .ch-dot { background: #7b61ff; }
.chan-c2 .ch-dot { background: #f2994a; }
.chan-c3 .ch-dot { background: #27ae60; }
.chan-c4 .ch-dot { background: #98a2b3; }

/* ---------- 渠道统计：今日速览（时段选项卡之上） ---------- */
.today-band {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 16px;
  margin: 10px 16px 8px; padding: 8px 13px;
  border: 1px solid #cfe7ee; border-radius: 9px;
  background: linear-gradient(180deg, #f3fafc 0%, #eaf5f9 100%);
}
.tb-title { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.tb-tag {
  background: var(--primary); color: #fff; font-size: 11.5px; font-weight: 600;
  line-height: 17px; padding: 0 7px; border-radius: 5px; letter-spacing: .02em;
}
.tb-date { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tb-metrics { display: flex; align-items: baseline; gap: 4px 16px; flex-wrap: wrap; }
.tb-m { font-size: 12px; color: var(--muted); white-space: nowrap; }
.tb-m b {
  font-size: 19px; font-weight: 700; color: var(--primary-dark); letter-spacing: -.01em;
  margin-right: 4px; font-variant-numeric: tabular-nums;
}
.tb-rate {
  font-size: 11.5px; line-height: 17px; color: var(--primary-dark);
  background: #fff; border: 1px solid #bfe0e9; border-radius: 20px; padding: 0 9px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.tb-chans {
  margin-left: auto; display: flex; align-items: center; flex-wrap: wrap; gap: 3px 11px;
  font-size: 11.5px; color: var(--muted);
}
.tb-chans .c { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.tb-chans .c b { color: #344054; font-weight: 600; font-variant-numeric: tabular-nums; }
.tb-chans .cd { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }

/* ---------- 渠道统计：时间段切换 ---------- */
.chan-toolbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px;
  padding: 9px 16px; border-top: 1px solid var(--line);
}
.chan-seg {
  display: inline-flex; background: #f1f5f9; border-radius: 8px; padding: 2px; gap: 2px;
  max-width: 100%;
}
.chan-seg .seg-btn {
  border: none; background: transparent; cursor: pointer;
  font-family: inherit; font-size: 12.5px; line-height: 1.5; color: var(--muted);
  padding: 4px 11px; border-radius: 6px; white-space: nowrap;
}
.chan-seg .seg-btn:hover { color: var(--primary-dark); }
.chan-seg .seg-btn.on {
  background: #fff; color: var(--primary-dark); font-weight: 600;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .08);
}
.chan-seg.mini .seg-btn { padding: 3px 9px; font-size: 12px; }

.chan-custom { display: flex; align-items: center; gap: 6px; }
.chan-custom input[type="date"] {
  font-family: inherit; font-size: 12.5px; color: #344054;
  border: 1px solid var(--line-strong); border-radius: 7px;
  padding: 4px 7px; background: #fff;
}
.chan-custom .sep { color: var(--muted-2); font-size: 12px; }
/* 自定义区间生效时，日期框加主色描边，替代「自定义」按钮的高亮 */
.chan-custom.active input[type="date"] {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
}
.chan-range-text {
  margin-left: auto; font-size: 12px; color: var(--muted);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

/* ---------- 渠道统计：累计趋势曲线 ---------- */
.chan-trend { border-top: 1px solid var(--line); padding: 10px 16px 12px; }
.trend-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.trend-kpi { flex: 1 1 320px; min-width: 0; }
.tk-line { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tk-line .ch-k { align-self: center; }
/* 合并大图：登记 / 到诊各一行数字，行内一条说明，比上下两块省一半高度 */
.tk-rows { display: flex; flex-direction: column; gap: 1px; }
.tk-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tk-row .ch-k { align-self: center; }
.tk-row .tk-value { font-size: 21px; }
.tk-row .tk-sub { margin-top: 0; }
.tk-row .tk-label { font-size: 12px; }
.tk-label { font-size: 12.5px; color: var(--muted); }
.tk-value {
  font-size: 23px; font-weight: 700; color: var(--primary-dark);
  letter-spacing: -.02em; line-height: 1.2;
}
.tk-value small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.tk-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tk-sub b { color: #344054; font-weight: 600; }
.tk-delta { font-weight: 600; }
.tk-delta.up { color: #15803d; }
.tk-delta.down { color: #b91c1c; }
.tk-delta.flat { color: var(--muted); }

.trend-chart { margin-top: 4px; }
.trend-chart svg { display: block; width: 100%; height: auto; }

/* ---------- 渠道统计：各渠道对比已并入卡片，此块样式不再使用 ---------- */

.trend-legend {
  display: flex; flex-wrap: wrap; gap: 4px 14px;
  font-size: 11.5px; color: var(--muted); margin-top: 2px;
}
.trend-legend .lg { display: inline-flex; align-items: center; gap: 5px; }
.trend-legend .ln { display: inline-block; width: 16px; height: 0; border-top: 2px solid #0e7490; }
.trend-legend .ln.prev { border-top: 2px dashed #a9b4c4; }
.trend-legend .note { color: var(--muted-2); }

/* 管理员：汇总之下的各客服明细 */
.chan-detail { border-top: 1px solid var(--line); margin-top: 10px; }
.chan-detail-head {
  display: flex; align-items: baseline; gap: 10px; padding: 9px 16px 7px;
}
.chan-detail-head h4 { font-size: 13.5px; font-weight: 600; color: var(--text); }
.chan-detail-head .count { color: var(--muted); font-size: 12px; }
table.chan-table { font-size: 13px; }
table.chan-table th:first-child, table.chan-table td:first-child { width: 150px; min-width: 110px; }
table.chan-table th.num, table.chan-table td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.chan-table td.strong { font-weight: 700; color: var(--primary-dark); }
table.chan-table .sr-role { margin-left: 6px; vertical-align: 1px; }
table.chan-table tfoot td {
  background: #fafbfc; font-weight: 600; color: #344054;
  border-top: 1px solid var(--line); padding: 8px 13px;
}
table.chan-table tfoot td:first-child { color: var(--muted); font-weight: 500; }

/* 手机端卡片式明细：默认隐藏，窄屏时才出现 */
.chan-mlist { display: none; }
.chan-mlist .cm-row { padding: 8px 0; border-top: 1px solid #f1f4f8; }
.chan-mlist .cm-row:first-child { border-top: none; }
.chan-mlist .cm-top { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 6px; }
.chan-mlist .cm-name { font-size: 13.5px; font-weight: 600; color: var(--primary-dark); }
.chan-mlist .cm-sum { margin-left: auto; font-size: 12px; color: var(--muted); }
.chan-mlist .cm-sum b { color: #344054; font-weight: 600; }
.chan-mlist .cm-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.chan-mlist .cm-chip {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary-dark); font-size: 11.5px; font-weight: 500;
}
.chan-mlist .cm-chip b { font-weight: 700; }
.chan-mlist .cm-chip.zero { background: var(--gray-bg); color: var(--muted); }
.chan-mlist .cm-foot {
  margin-top: 2px; font-size: 12px; color: var(--muted);
  border-top: 1px solid var(--line); padding-top: 8px;
}
.chan-mlist .cm-foot b { color: #344054; }



.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 12px; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.panel-head h3 { font-size: 14.5px; white-space: nowrap; }
.panel-head .count { color: var(--muted); font-size: 12.5px; min-width: 0; }
.panel-head .spacer { flex: 1; }
.panel-body { padding: 12px 16px; }
.panel-body.pad-0 { padding: 0; }

/* ---------- 看板网格（工作台）----------
   宽屏下面板两两并排，避免整宽面板内部出现大片横向空白。
   align-items:start 让面板保持自身高度，不被强行拉长。 */
.board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}
.board > .panel { margin-bottom: 0; }
.board .panel-head { min-width: 0; }
.board .panel-head h3 { min-width: 0; }
.board .panel-head .count { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 栏宽只有整宽的一半时（≥1240px 才分栏）：
   待办行改为上下堆叠 —— 患者块 / 信息块 / 按钮各占一行，
   信息不被挤压、按钮等宽铺满，横向不留空 */
@media (min-width: 1240px) {
  .board .todo-item { flex-wrap: wrap; align-items: flex-start; gap: 8px 12px; padding: 11px 14px; }
  .board .todo-item .who { flex: 1 1 100%; }
  .board .todo-item .what { flex: 1 1 100%; max-width: none; }
  .board .todo-item .what .cond { white-space: normal; }
  .board .todo-item .row-actions { flex: 1 1 100%; margin-left: 0; }
  .board .todo-item .row-actions .btn { flex: 1; }

  /* 窄栏里的空态收一档内边距，避免一小句话占掉一大块面板 */
  .board .empty { padding: 22px 16px; }

  /* 看板里的表格只有半栏宽：首列不再固定 260px，副信息省略号收口，
     并收紧左右内边距，让 4 列能在半栏内排下（否则会横向滚动） */
  .board table.data th:first-child,
  .board table.data td:first-child { width: 40%; min-width: 0; }
  .board table.data .p-sub {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
  }
  .board table.data th,
  .board table.data td { padding-left: 11px; padding-right: 11px; }
}

/* 窄于 1240px：内容区已不足以放下两个半栏，回到单栏整宽（此时整宽面板内容几乎铺满，不会显空） */
@media (max-width: 1239px) {
  .board { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
/* 列宽按内容分配：患者列固定舒适宽度，其余列紧凑；表格不强行铺满 */
table.data { border-collapse: collapse; font-size: 13.5px; width: 100%; }
table.data thead { background: #fafbfc; }
table.data th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 12.5px;
  padding: 8px 13px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data td { padding: 9px 13px; border-bottom: 1px solid #f1f4f8; vertical-align: middle; }
/* 患者列给足空间但设上限，数据少时也不被拉宽 */
table.data th:first-child, table.data td:first-child { width: 260px; min-width: 190px; }
/* 末列之后由表格吸收剩余宽度，但表头/行背景保持连续 */
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: #fafcfe; }
table.data tbody tr:last-child td { border-bottom: none; }
td.nowrap, th.nowrap { white-space: nowrap; }
.ellipsis { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; }

/* 患者姓名 + 从其下小字（性别年龄、登记信息等次要信息下沉） */
.p-name { font-weight: 600; color: var(--primary-dark); font-size: 13.5px; }
.p-sub { color: var(--muted-2); font-size: 12px; line-height: 1.3; margin-top: 1px; }
/* 「其他客服也在跟进」：跟在姓名后面的括号说明，紫一点但别抢主信息。
   列表里是 <button>（点开看跟进记录简要），所以要把按钮外观抹平。 */
.p-multi { margin-left: 5px; font-size: 11.5px; color: #6d28d9; white-space: nowrap; }
button.p-multi {
  background: none; border: 0; padding: 0; font-family: inherit; cursor: pointer;
  text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px;
}
button.p-multi:hover { color: #5b21b6; }
button.p-multi:focus-visible { outline: 2px solid #c4b5fd; outline-offset: 2px; border-radius: 3px; }
/* 「（梁华琴 登记）」：只说明归属，点不开东西，所以用冷灰蓝、不加下划线，
   跟可点的「也在跟进」区分开，免得客服以为点了能看记录。 */
.p-multi.owner { color: #64748b; }

/* 「跟进记录简要」弹窗：顶部汇总 + 参与客服 chip + 时间线 */
.cd-sum { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.cd-sum b { color: #344054; font-weight: 600; }
.cd-who { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.cd-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; line-height: 20px; padding: 0 8px; border-radius: 10px;
  background: #eef4ff; color: #1d4ed8; border: 1px solid #dbe7ff;
}
.cd-chip.me { background: #f4f6f9; color: #475467; border-color: #e4e7ec; }
.cd-chip i { font-style: normal; font-size: 10.5px; opacity: .7; }
.cd-chip b { font-weight: 700; }

/* 「已加微信」列：已加=浅绿底勾标，未加=灰字（选填项，没勾就是未加，别用红警示） */
.wx-tag {
  display: inline-block; font-size: 11.5px; font-weight: 600; line-height: 17px;
  padding: 0 6px; border-radius: 4px;
  background: #e8f7ef; color: #15803d;
}
.wx-tag.no { background: #f4f6f9; color: var(--muted-2); font-weight: 500; }

/* 登记客服：列表里独立成列（姓名 + 其下小字「首次登记」日期）。
   这个日期固定取**第一次登记时间**，不是 updated_at —— 编辑资料、核对手机号、
   导入门诊/住院数据都不会影响它，避免客服以为「登记客服和时间对不上」。 */
table.data td.col-reg { white-space: nowrap; }
.reg-name { font-weight: 600; color: #344054; font-size: 13px; }
.reg-first { font-size: 11px; color: var(--muted-2); letter-spacing: .2px; }
.reg-chip {
  display: inline-block; margin-left: 6px; padding: 0 6px;
  border-radius: 999px; background: var(--primary-soft); color: var(--primary-dark);
  font-size: 11.5px; font-weight: 600; line-height: 17px; vertical-align: 1px;
}

/* 整行可点：省去单独的「查看」列，点击行内任意处进入详情 */
tr.row-click { cursor: pointer; }
tr.row-click:hover { background: #f5fafc; }
tr.row-click:hover .p-name { text-decoration: underline; text-underline-offset: 2px; }

/* 空态：单行横向排列（图标 + 文字），避免上下堆叠造成大片空白 */
.empty {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  flex-wrap: wrap; text-align: center;
  padding: 18px 20px; color: var(--muted-2); font-size: 13px;
}
.empty .big { font-size: 17px; margin: 0; opacity: .5; line-height: 1; }
.empty .muted { font-size: 12.5px; }
/* 表格内的空态再收一档 */
.empty.compact { padding: 14px 20px; }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- 待办条目 ---------- */
.todo-list { display: flex; flex-direction: column; }
.todo-item {
  display: flex; align-items: center; gap: 14px; padding: 10px 16px;
  border-bottom: 1px solid #f1f4f8;
}
.todo-item:last-child { border-bottom: none; }
.todo-item:hover { background: #fafcfe; }

/* 1. 患者块：姓名醒目、电话等宽数字便于复述 */
.todo-item .who { flex: 0 0 176px; min-width: 0; }
.todo-item .who .nm { font-weight: 600; font-size: 14px; line-height: 1.3; }
.todo-item .who .meta { color: var(--muted); font-size: 12.5px; line-height: 1.35; margin-top: 1px; }
.todo-item .who .tel { font-variant-numeric: tabular-nums; color: #334155; }

/* 2. 预约信息：时间与倒计时徽标同排，病情简述次之 */
/* max-width 收口：不让信息块吃掉整行，操作按钮因此左移贴近内容 */
.todo-item .what { flex: 1 1 auto; min-width: 0; max-width: 560px; }
.todo-item .what .when { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.todo-item .what .when .t { font-weight: 500; display: inline-flex; align-items: baseline; gap: 5px; min-width: 0; }
/* 时间前的标签（预约就诊 / 上次咨询 / 跟进日）：让每个时间自带说明，避免看不懂 */
.todo-item .what .when .t .tl {
  font-size: 11px; font-style: normal; font-weight: 500; color: #475569;
  background: #eef2f7; border-radius: 4px; padding: 0 5px; line-height: 17px; white-space: nowrap;
}
.todo-item .what .when .t.sub { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.todo-item .what .when .t.sub .tl { color: #94a3b8; background: transparent; border: 1px solid #e6ebf2; }
.todo-item .what .cond {
  color: var(--muted); font-size: 12.5px; margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.src-chip {
  font-size: 11.5px; color: var(--primary-dark); background: var(--primary-soft);
  padding: 1px 7px; border-radius: 999px; white-space: nowrap;
}
/* 联系次数徽标：首次登记算 1 次，之后每录一条回访 +1 */
.fu-chip {
  font-size: 11.5px; color: #0f766e; background: #e7f6f3;
  padding: 1px 8px; border-radius: 999px; white-space: nowrap; flex: 0 0 auto; font-weight: 500;
}

/* 倒计时徽标：紧随时间，不再推到最右 */
.due-badge {
  font-size: 11.5px; color: var(--amber); background: var(--amber-bg);
  padding: 1px 8px; border-radius: 999px; white-space: nowrap; flex: 0 0 auto;
  font-weight: 500;
}
.due-badge.overdue { color: var(--red); background: var(--red-bg); }

/* 3. 操作区紧随信息块（不再 margin-left:auto 推到最右） */
.todo-item .row-actions { flex: 0 0 auto; }

/* ---------- 筛选栏 ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters input[type="search"], .filters select, .filters input[type="date"] {
  padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; outline: none;
}
.filters input[type="search"] { min-width: 230px; }
.filters input:focus, .filters select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14, 116, 144, .12); }
.filters .spacer { flex: 1; }

/* 状态分布速览（点选即筛选） */
.status-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line-strong); background: #fff; color: var(--text);
  padding: 4px 11px; border-radius: 999px; font-size: 12.5px;
  transition: background .15s, border-color .15s, color .15s;
}
.status-pill:hover { background: #f4f8fa; border-color: #c3ccda; }
.status-pill .n { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--muted); }
.status-pill.on { background: var(--primary-soft); border-color: #bfe0ea; color: var(--primary-dark); font-weight: 600; }
.status-pill.on .n { color: var(--primary-dark); }

/* ---------- 表单 ---------- */
/* 弹性行布局：字段宽度按内容长短分档，短字段（性别/年龄）不再被拉长 */
.form-grid { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-start; }
.form-grid > .field { min-width: 0; }
.form-grid .w-xs { flex: 0 0 72px; }     /* 性别 / 年龄 */
.form-grid .w-sm { flex: 0 0 116px; }    /* 渠道 / 状态 */
.form-grid .w-md { flex: 0 0 158px; }    /* 姓名 / 电话（电话框要留出「粘贴」按钮的位置） */
.form-grid .w-lg { flex: 0 0 186px; }    /* 日期 / 时间 */
.form-grid .w-fill { flex: 1 1 260px; }  /* 单选组 / 长文本 / 原因：占满剩余 */
.form-grid .full { flex: 1 1 100%; }     /* 独占整行 */
.form-grid .form-row { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 10px 12px; } /* 成对字段固定并排 */
.form-grid .form-row > .field { flex: 1 1 0; min-width: 0; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.field label .req { color: var(--red); margin-left: 2px; }
.field label .label-hint { color: var(--muted-2); font-weight: 400; margin-left: 5px; font-size: 11.5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 8px 10px; font-size: 13.5px; border: 1px solid var(--line-strong);
  border-radius: 8px; background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 54px; line-height: 1.5; }
/* 表单里的文字必须可选、可粘贴：个别安卓输入法在数字键盘下不弹「粘贴」 */
.field input, .field textarea { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
/* 号码框右侧的「粘贴」按钮（读剪贴板自动清洗成纯数字） */
.input-wrap { position: relative; display: block; }
.input-wrap > input { padding-right: 48px; }
/* 表单里自动补的「粘贴」按钮：默认不显示（桌面端照旧 Ctrl+V），只在触屏露出 */
.paste-mini.in-field { display: none; }
.input-wrap.in-field > input, .input-wrap.in-field > textarea { padding-right: 10px; }
.input-wrap.ta .paste-mini { top: 5px; transform: none; }
.paste-mini {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  height: 26px; padding: 0 7px; font-size: 11.5px; line-height: 1;
  border: 1px solid var(--line-strong); border-radius: 6px;
  background: #f6f8fb; color: var(--muted); cursor: pointer;
  transition: border-color .12s, color .12s, background .12s;
}
.paste-mini:hover, .paste-mini:active { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-soft); }
/* 详情里的「复制」按钮 */
.copy-mini {
  margin-left: 6px; height: 21px; padding: 0 7px; font-size: 11.5px; line-height: 1;
  border: 1px solid var(--line-strong); border-radius: 6px;
  background: #f6f8fb; color: var(--muted); cursor: pointer; vertical-align: 1px;
}
.copy-mini:hover, .copy-mini:active { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-soft); }
/* 手机号已按医院就诊表格纠正过的标记（详情页「联系电话」旁） */
.fix-badge {
  display: inline-block; margin-left: 6px; padding: 1px 7px 2px;
  font-size: 11px; line-height: 1.35; font-weight: 600;
  color: var(--green); background: var(--green-bg);
  border-radius: 999px; vertical-align: 1px; white-space: nowrap;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14, 116, 144, .12);
}
.radio-row { display: flex; flex-wrap: wrap; gap: 8px 16px; padding-top: 3px; min-height: 33px; align-items: center; }
.radio-row label { display: inline-flex; align-items: center; gap: 6px; color: var(--text); margin: 0; font-size: 13.5px; cursor: pointer; }
.radio-row input { width: auto; }
/* 单个可勾选项（如「已加微信」）：整块可点，勾上后描边变主色，避免小方框难点 */
.check-row { padding-top: 3px; min-height: 33px; display: flex; align-items: center; }
.field label.check-pill {
  display: inline-flex; align-items: center; gap: 7px; margin: 0;
  height: 34px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: #fff; font-size: 13.5px; color: var(--text); cursor: pointer; user-select: none;
  transition: border-color .15s, background .15s, color .15s;
}
.check-pill input { width: auto; margin: 0; accent-color: var(--primary); }
.check-pill:hover { border-color: var(--primary); }
.check-pill.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.sub-label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
@media (max-width: 760px) {
  /* 窄屏：姓名/电话 并排，日期与单选组独占一行，性别/年龄/渠道 保持窄框 */
  .form-grid .w-md { flex: 1 1 122px; }
  .form-grid .w-lg, .form-grid .w-fill, .form-grid .full { flex: 1 1 100%; }
  .form-grid .form-row > .field { flex: 1 1 100%; }
  /* 触屏上「粘贴」按钮做高一点，避免点不中；号码框保持能容下 11 位 */
  .paste-mini { height: 28px; padding: 0 5px; font-size: 11px; right: 3px; }
  .input-wrap > input { padding-right: 36px; }
}

/* 触屏（手机 / 平板）：表单里每个能填字的框右侧都露一个「粘贴」按钮。
   国产输入法在数字键盘下不弹「粘贴」，长按又常常选中旁边的标签文字；
   顺带把输入框加高到 40px，长按更容易落在框里，选词 / 复制 / 粘贴都更顺手。 */
@media (hover: none) {
  .paste-mini.in-field {
    display: inline-flex; align-items: center; justify-content: center;
    height: 26px; padding: 0 4px; font-size: 10.5px; right: 3px;
    background: rgba(246, 248, 251, .94);
  }
  .field .input-wrap > input,
  .field .input-wrap > textarea { padding-right: 37px; }
  .field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  .field select { min-height: 40px; }
  .field textarea { min-height: 66px; }
}

/* ---------- 就诊凭证（点击上传 / 粘贴 / 拖拽） ---------- */
.vch-count { float: right; color: var(--muted-2); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.voucher-box {
  position: relative; border: 1px dashed var(--line-strong); border-radius: 10px;
  background: #fbfcfe; padding: 8px; outline: none; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.voucher-box:hover { border-color: var(--primary); background: #f7fbfd; }
.voucher-box:focus-visible { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14, 116, 144, .12); }
.voucher-box.drag { border-color: var(--primary); border-style: solid; background: var(--primary-soft); }
.vch-drop { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 15px 10px 17px; text-align: center; }
.vch-ico { width: 30px; height: 30px; border-radius: 50%; background: #eef4f7; color: var(--primary); font-size: 18px; line-height: 30px; }
.vch-tip { font-size: 13px; color: var(--text); }
.vch-tip b { color: var(--primary-dark); }
.vch-sub { font-size: 11.5px; color: var(--muted-2); }
.vch-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.vch-grid.detail { margin-top: 2px; }
.vch-item { position: relative; width: 92px; height: 92px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: #f2f5f9; }
.vch-item img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.vch-item.bad { display: flex; align-items: center; justify-content: center; color: var(--muted-2); font-size: 11.5px; background: #f6f8fb; }
.vch-item .vch-x {
  position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; padding: 0;
  border: none; border-radius: 50%; background: rgba(16, 24, 40, .55); color: #fff; font-size: 15px; line-height: 20px;
}
.vch-item .vch-x:hover { background: var(--red); }
.vch-size { position: absolute; left: 0; right: 0; bottom: 0; padding: 1px 0; background: rgba(16, 24, 40, .55); color: #fff; font-size: 10.5px; text-align: center; }
.vch-add {
  width: 92px; height: 92px; border: 1px dashed var(--line-strong); border-radius: 8px; background: #fff;
  color: var(--muted); font-size: 11.5px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.vch-add .plus { font-size: 18px; line-height: 1; color: var(--primary); }
.vch-add:hover { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-soft); }
.vch-status { font-size: 11.5px; color: var(--amber); }
.vch-status.on { padding: 4px 2px 2px; }
.vch-empty { font-size: 13px; padding: 2px 0; }
.vch-preview { text-align: center; }
.vch-preview img { max-width: 100%; max-height: 70vh; border: 1px solid var(--line); border-radius: 8px; }

/* 详情页底部「就诊凭证」折叠区：主要给财务核对，默认收起，不占正常浏览版面 */
.vch-fold {
  margin: 6px 0 2px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 9px; background: #fbfcfd;
}
.vch-fold > summary.vf-sum {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 0; cursor: pointer; list-style: none;
  font-size: 13px; font-weight: 600; color: var(--primary-dark);
}
.vch-fold > summary.vf-sum::-webkit-details-marker { display: none; }
.vch-fold > summary.vf-sum::before { content: '▸'; font-size: 10px; color: var(--muted-2); }
.vch-fold[open] > summary.vf-sum::before { content: '▾'; }
.vch-fold > summary.vf-sum:hover { color: var(--primary); }
.vch-fold > summary.vf-sum:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.vch-fold .vf-hint { margin-left: auto; font-weight: 400; font-size: 11.5px; color: var(--muted-2); }
.vch-fold .vch-body { padding: 1px 0 11px; }
.vch-fold .vch-empty { font-size: 12.5px; }
.vch-fold .vf-tip { margin-top: 9px; font-size: 11.5px; color: var(--muted-2); }
@media (max-width: 760px) {
  /* 手机上缩略图小一点，一行能排 4 张 */
  .vch-item, .vch-add { width: 72px; height: 72px; }
  .vch-drop { padding: 13px 8px 15px; }
  .vch-item .vch-x { width: 24px; height: 24px; line-height: 22px; }
  .vch-fold { padding: 0 10px; }
  .vch-fold > summary.vf-sum { font-size: 13px; padding: 10px 0; }
  .vch-fold .vf-hint { font-size: 11px; }
}

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 24px 16px; overflow-y: auto; z-index: 100;
  animation: fade .16s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 100%; background: var(--panel); border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(16, 24, 40, .22); animation: pop .18s ease-out;
}
@keyframes pop { from { transform: translateY(8px) scale(.99); opacity: 0; } }
.modal-head { display: flex; align-items: center; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 15px; flex: 1; }
.modal-x {
  border: none; background: none; font-size: 22px; line-height: 1; color: var(--muted-2);
  /* 34×34 的点击热区：原来只有文字大小，手机/触控板容易点空 */
  width: 34px; height: 34px; margin: -6px -8px -6px 0; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; cursor: pointer;
}
.modal-x:hover { color: var(--text); background: #f2f4f7; }
.modal-x:active { background: #e9edf3; }
.modal-body { padding: 14px 16px; }
.modal-foot { padding: 11px 16px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- 客服名单选择 ---------- */
.staff-pick { display: flex; flex-direction: column; gap: 7px; }
.staff-pick-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px; border: 1px solid var(--line-strong); background: #fff;
  border-radius: 9px; cursor: pointer; text-align: left; font-size: 14px; color: var(--text);
  transition: border-color .12s, background .12s;
}
.staff-pick-item:hover { border-color: #9ecfdd; background: #f7fcfd; }
.staff-pick-item.on { border-color: var(--primary); background: var(--primary-soft); font-weight: 600; }
.staff-pick-item.on::after { content: "当前"; margin-left: 8px; font-size: 11px; font-weight: 500; color: var(--primary-dark); }
.staff-pick-item .sp-avatar {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.staff-pick-item.on .sp-avatar { background: var(--primary); color: #fff; }
.staff-pick-item .sp-name { flex: 1 1 auto; min-width: 0; }
.staff-pick-item .sp-role { flex: 0 0 auto; font-size: 11.5px; color: var(--muted-2); font-weight: 400; }
.staff-manual { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.staff-manual label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.staff-manual input {
  width: 100%; padding: 8px 11px; border: 1px solid var(--line-strong);
  border-radius: 8px; font-size: 14px; font-family: inherit; color: var(--text);
}
.staff-manual input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* ---------- 详情 ---------- */
.detail-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.detail-head .nm { font-size: 18px; font-weight: 700; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 16px; }
.kv .k { color: var(--muted); font-size: 12.5px; }
.kv .v { font-size: 14px; word-break: break-word; }
.section-title { font-size: 13.5px; font-weight: 600; color: var(--muted); margin: 16px 0 8px; letter-spacing: .02em; }

.timeline { border-left: 2px solid var(--line); margin-left: 6px; padding-left: 16px; }
.tl-item { position: relative; padding-bottom: 12px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: -23px; top: 5px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--primary); border: 2px solid #fff; box-shadow: 0 0 0 2px #cbe6ee;
}
.tl-item.visited::before { background: var(--green); box-shadow: 0 0 0 2px #bbf7d0; }
.tl-item.no_show::before { background: var(--red); box-shadow: 0 0 0 2px #fecaca; }
.tl-item.cancelled::before { background: var(--muted-2); box-shadow: 0 0 0 2px var(--line); }
.tl-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tl-time { font-weight: 600; }
.tl-body { color: var(--muted); font-size: 13px; margin-top: 3px; }

.note-box { background: #fafbfc; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 13.5px; white-space: pre-wrap; }

/* ---------- Toast ---------- */
#toastRoot { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast {
  background: #101828; color: #fff; padding: 11px 16px; border-radius: 9px;
  box-shadow: var(--shadow); font-size: 13.5px; max-width: 340px;
  animation: slideIn .2s ease-out;
}
.toast.ok { background: #14603a; }
.toast.err { background: #9f1b1b; }
@keyframes slideIn { from { transform: translateX(16px); opacity: 0; } }
/* 手机上弹窗底部是「取消 / 保存」按钮条：提示条抬到按钮上方，别把主按钮遮住 */
@media (max-width: 760px) {
  #toastRoot {
    left: 12px; right: 12px; bottom: calc(78px + env(safe-area-inset-bottom));
    align-items: center;
  }
  .toast { max-width: 100%; font-size: 13px; padding: 10px 14px; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .stat-card { flex: 0 1 calc(50% - 6px); }
}
@media (max-width: 980px) {
  /* 中等宽度：患者块收窄，给信息区让位 */
  .todo-item .who { flex: 0 0 150px; }
}
/* 8 列（患者…已加微信…）在 ~1024px 会差几十像素，收紧内边距与首列宽度把它吃进去；
   再窄就走下面 860px 的横向滚动方案，不硬压。 */
@media (max-width: 1180px) and (min-width: 861px) {
  table.data th, table.data td { padding-left: 10px; padding-right: 10px; }
  table.data th:first-child, table.data td:first-child { width: 215px; min-width: 168px; }
}
@media (max-width: 860px) {
  .app { flex-direction: column; }
  /* 手机端侧栏变横向导航条，没地方放版本行（要靠它判断新旧请用桌面端） */
  .ver-line { display: none; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; }
  .side-nav { display: flex; gap: 6px; overflow-x: auto; padding: 10px; }
  .nav-item { margin: 0; white-space: nowrap; }
  .side-foot { display: flex; align-items: center; gap: 12px; margin-top: 0; }
  .side-foot .foot-actions { margin: 0; }
  .kv { grid-template-columns: 1fr 1fr; }
  .content { padding: 14px 14px 24px; }
  .topbar { padding: 14px 16px; gap: 10px; }
  .topbar h1 { font-size: 16px; white-space: nowrap; }
  .topbar .today { font-size: 12px; }

  /* 表格：保持列的自然宽度并横向滚动，避免「姓名」被压成一字一行 */
  table.data { width: max-content; min-width: 100%; }
  table.data th, table.data td { white-space: nowrap; }
  /* 窄屏患者列收窄，把空间让给后面几列 */
  table.data th:first-child, table.data td:first-child { width: auto; min-width: 132px; }
  .ellipsis { max-width: 190px; }

  /* 窄屏待办行：上下堆叠，时间与徽标同排，按钮等宽铺满 */
  .todo-item { flex-wrap: wrap; align-items: flex-start; gap: 8px 12px; padding: 11px 14px; }
  .todo-item .who { flex: 1 1 100%; }
  .todo-item .what { flex: 1 1 100%; max-width: none; }
  .todo-item .what .cond { white-space: normal; }
  .todo-item .row-actions { flex: 1 1 100%; margin-left: 0; }
  .todo-item .row-actions .btn { flex: 1; }

  /* 窄屏隐藏侧栏速览（手机端工作台已有统计卡，避免导航被挤到下方） */
  .side-brief { display: none; }
  /* 窄屏面板头：标题单行不换行，说明文字省略以免挤压标题 */
  .panel-head { gap: 8px; padding: 10px 12px; }
  .panel-head .count { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* 顶栏「← 返回」：仅在二级页面出现（工作台时隐藏） */
  .topbar-back:not([hidden]) { display: inline-flex; align-items: center; }

  /* 弹窗改成全屏：标题栏与底部操作固定，正文自己滚动——
     长内容（如患者详情）滑到中间也能随时返回，不会找不到关闭按钮 */
  .modal-mask { padding: 0; overflow: hidden; }
  .modal {
    max-width: none !important; width: 100%; height: 100%;
    border-radius: 0; display: flex; flex-direction: column;
  }
  .modal-head { flex: 0 0 auto; padding: 10px 14px; background: var(--panel); }
  .modal-head h3 { font-size: 15.5px; }
  .modal-x { font-size: 26px; width: 44px; height: 44px; margin: -8px -10px -8px 0; }
  .modal-body { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px; }
  .modal-foot {
    flex: 0 0 auto; position: sticky; bottom: 0; background: var(--panel);
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); gap: 9px;
  }
  .modal-foot .btn { flex: 1 1 auto; justify-content: center; }
}

@media (max-width: 560px) {
  /* 超窄屏：日期让位给页面标题与主按钮 */
  .topbar .today { display: none; }
  .stat-card { flex: 1 1 calc(50% - 6px); min-width: 0; padding: 12px 13px; }
  .stat-card .value { font-size: 23px; }
}

/* =========================================================
   身份绑定（激活页） / 管理中心 / 操作留痕
   ========================================================= */

/* ---------- 激活态：侧栏与顶栏让位，界面只剩激活卡片 ---------- */
.app.claiming .sidebar,
.app.claiming .topbar { display: none; }
.app.claiming .content { display: flex; align-items: center; justify-content: center; }

.claim-card {
  width: 100%; max-width: 520px; margin: 0 auto;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 30px 32px 26px; text-align: center;
}
.claim-badge {
  display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: .04em;
  color: var(--primary-dark); background: var(--primary-soft);
  border-radius: 999px; padding: 3px 12px; margin-bottom: 12px;
}
.claim-card h2 { margin: 0 0 10px; font-size: 20px; color: var(--text); }
.claim-desc { margin: 0 0 20px; color: var(--muted); font-size: 13.5px; line-height: 1.65; }
.claim-row { display: flex; gap: 10px; }
.claim-row input {
  flex: 1; min-width: 0; height: 42px; padding: 0 13px;
  font-size: 15.5px; font-family: ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: .08em; text-transform: uppercase;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: #fff; color: var(--text);
}
.claim-row input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14,116,144,.12); }
.claim-msg { min-height: 18px; margin-top: 10px; font-size: 12.5px; color: var(--red); }
.claim-help { margin-top: 6px; font-size: 12.5px; color: var(--muted-2); }

/* ---------- 侧栏角色标签 ---------- */
.user-meta .name { display: flex; align-items: center; flex-wrap: wrap; }
.user-role {
  display: inline-block; margin-left: 6px; vertical-align: 1px;
  font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 999px;
  background: var(--gray-bg); color: var(--gray);
}
.user-role.admin { background: var(--primary-soft); color: var(--primary-dark); }

/* ---------- 管理中心：子标签 ---------- */
.admin-tabs { display: flex; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: #fafbfc; flex-wrap: wrap; }
.admin-tab {
  border: 1px solid transparent; background: transparent; color: var(--muted);
  font-size: 13px; font-weight: 500; padding: 5px 13px; border-radius: 999px;
}
.admin-tab:hover { background: #eef2f6; color: var(--text); }
.admin-tab.on { background: var(--primary-soft); border-color: #bfe0ea; color: var(--primary-dark); font-weight: 600; }

/* ---------- 管理中心：客服行 ---------- */
.staff-row {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px; border-bottom: 1px solid #f1f4f8;
}
.staff-row:last-child { border-bottom: none; }
.staff-row:hover { background: #fafcfe; }
.sr-main { flex: 1 1 auto; min-width: 0; }
.sr-name { font-size: 14px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.sr-role { font-size: 10.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--gray-bg); color: var(--gray); }
.sr-role.admin { background: var(--primary-soft); color: var(--primary-dark); }
.sr-sub { margin-top: 3px; }
.sr-acts { display: flex; gap: 6px; flex: 0 0 auto; flex-wrap: wrap; }

.chip { display: inline-block; font-size: 11.5px; padding: 1px 9px; border-radius: 999px; font-weight: 500; }
.chip-on { background: var(--green-bg); color: var(--green); }
.chip-wait { background: var(--amber-bg); color: var(--amber); }
.chip-off { background: var(--gray-bg); color: var(--gray); }

/* ===== 账号管理（2026-10-23）：姓名下面带账号，密码单列可复制 ===== */
.chip-super { background: #ede9fe; color: #6d28d9; }
.chip-admin { background: var(--primary-soft); color: var(--primary-dark); }
.chip-plain { background: var(--gray-bg); color: var(--gray); }
.acct-table { min-width: 940px; }
.acct-table td { vertical-align: middle; }
.acct-table .chip { white-space: nowrap; }
.acct-table th:nth-child(3), .acct-table td:nth-child(3),
.acct-table th:nth-child(4), .acct-table td:nth-child(4),
.acct-table th:nth-child(5), .acct-table td:nth-child(5),
.acct-table th:nth-child(6), .acct-table td:nth-child(6) { white-space: nowrap; }
.acct-table .u-name { font-weight: 600; color: #344054; font-size: 13.5px; }
.acct-table .u-acc { font-size: 12px; color: var(--muted-2); margin-top: 1px; font-variant-numeric: tabular-nums; }
.pw-cell { display: inline-flex; align-items: center; gap: 6px; }
.pw-cell code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px; background: #f2f6fa; border: 1px solid var(--line);
  border-radius: 6px; padding: 2px 7px; color: #1d2939; white-space: nowrap;
}
.btn-xs { padding: 2px 8px; font-size: 11.5px; border-radius: 6px; }
.btn-danger { background: var(--red-bg); border: 1px solid #f5c2c2; color: var(--red); }
.btn-danger:hover { background: #fcdada; }
.u-acts { white-space: nowrap; }
.u-acts .btn + .btn { margin-left: 4px; }
.acct-tip { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; }
.acct-tip p { margin: 0 0 5px; font-size: 12.5px; color: var(--muted); line-height: 1.65; }
.acct-tip p:last-child { margin-bottom: 0; }
.acct-tip b { color: #344054; }
.pw-row { display: flex; gap: 8px; align-items: center; }
.pw-row input { flex: 1 1 auto; }
.pw-show {
  display: flex; align-items: center; gap: 10px;
  background: #f2f6fa; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
}
.pw-show code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 19px; letter-spacing: .06em; color: #1d2939; flex: 1 1 auto;
  word-break: break-all;
}

.admin-note { padding: 10px 16px 12px; color: var(--muted-2); font-size: 12.5px; line-height: 1.6; border-top: 1px dashed var(--line); }

/* ---------- 管理中心：工作量排行 ---------- */
.rank-row {
  display: flex; align-items: center; gap: 14px;
  padding: 9px 16px; border-bottom: 1px solid #f1f4f8; font-size: 13.5px;
}
.rank-row:last-child { border-bottom: none; }
.rk-name { flex: 0 0 130px; font-weight: 600; color: var(--text); }
.rk-nums { margin-left: auto; display: flex; gap: 16px; color: var(--muted); font-size: 12.5px; }
.rk-n b { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- 管理中心：操作日志 ---------- */
.log-list { max-height: 560px; overflow-y: auto; }
.log-row {
  display: flex; align-items: baseline; gap: 12px;
  padding: 8px 16px; border-bottom: 1px solid #f1f4f8; font-size: 13px;
}
.log-row:last-child { border-bottom: none; }
.lg-time { flex: 0 0 132px; color: var(--muted-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.lg-who { flex: 0 0 80px; font-weight: 600; color: var(--primary-dark); }
.lg-what { flex: 1 1 auto; min-width: 0; color: var(--text); }

/* ---------- 认领码展示 ---------- */
.code-box {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 22px; letter-spacing: .1em; font-weight: 700; text-align: center;
  color: var(--primary-dark); background: var(--primary-soft);
  border: 1px dashed #9fcbdb; border-radius: var(--radius);
  padding: 14px 10px; user-select: all;
}
.code-warn { margin: 10px 0 0; font-size: 12.5px; color: var(--amber); }

/* ---------- 我的身份 ---------- */
.me-card { display: flex; align-items: center; gap: 13px; }
.me-avatar {
  width: 46px; height: 46px; flex: 0 0 46px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: 18px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.me-info { min-width: 0; }
.me-name { font-size: 16px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.me-role { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--gray-bg); color: var(--gray); }
.me-role.admin { background: var(--primary-soft); color: var(--primary-dark); }
.me-acc { margin-top: 2px; font-size: 12.5px; color: var(--muted); }

/* ---------- 窄屏适配 ---------- */
@media (max-width: 760px) {
  .claim-card { padding: 22px 18px; }
  .claim-row { flex-direction: column; }
  .staff-row { flex-wrap: wrap; align-items: flex-start; gap: 8px; }
  .sr-main { flex: 1 1 100%; }
  .sr-acts { flex: 1 1 100%; }
  .log-row { flex-wrap: wrap; gap: 4px 10px; }
  .lg-time { flex: 0 0 auto; }
  .lg-who { flex: 0 0 auto; }
  .lg-what { flex: 1 1 100%; }
  .rk-name { flex: 0 0 88px; }
  .rk-nums { gap: 10px; }
}
/* ---------- 通话录音 / 实时转写（回访弹窗内） ---------- */
.rec-field { margin-top: 4px; }
.rec-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.btn-rec { background: var(--panel); border-color: var(--line-strong); color: var(--text); }
.btn-rec:hover { border-color: var(--primary); color: var(--primary-dark); }
.btn-rec.on { background: var(--red); border-color: var(--red); color: #fff; }
.btn-rec.on:hover { background: #991b1b; border-color: #991b1b; color: #fff; }
.rec-time { font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: 15px; font-weight: 500; color: var(--text); letter-spacing: 0.5px; }
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--red); animation: recPulse 1.1s ease-in-out infinite; }
@keyframes recPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.rec-status { font-size: 12.5px; color: var(--muted); }
.rec-status.on { color: var(--red); font-weight: 500; }
.rec-live { margin-top: 8px; padding: 9px 11px; border: 1px dashed #bfe0ea; border-radius: 8px; background: var(--primary-soft); color: #0b4f5e; font-size: 13px; line-height: 1.7; max-height: 108px; overflow: auto; }
.rec-audio { width: 100%; margin-top: 8px; height: 36px; }
.rec-text { width: 100%; margin-top: 8px; min-height: 96px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 8px; font-family: inherit; font-size: 13.5px; line-height: 1.7; color: var(--text); background: var(--panel); resize: vertical; }
.rec-text:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14, 116, 144, 0.12); }
.rec-hint { margin-top: 6px; font-size: 12.5px; line-height: 1.6; color: var(--muted); }
.rec-hint.warn { color: var(--amber); }
.rec-hint.err { color: var(--red); }

/* ---------- 通话质检页 ---------- */
.call-list { display: flex; flex-direction: column; gap: 12px; padding: 4px 0 2px; }
.call-card { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); padding: 14px 16px; }
.cc-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cc-who { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.cc-name { font-size: 15px; font-weight: 500; color: var(--text); }
.cc-phone { font-size: 12.5px; color: var(--muted); }
.cc-score { margin-left: auto; flex: 0 0 auto; min-width: 46px; text-align: center; padding: 3px 9px; border-radius: 999px; font-size: 14px; font-weight: 500; }
.cc-meta { margin-top: 5px; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.src-tag { display: inline-block; padding: 1px 6px; border-radius: 5px; background: var(--gray-bg); color: var(--gray); font-size: 11.5px; }
.cc-audio { margin-top: 9px; }
.cc-sec { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.cc-sec > summary { cursor: pointer; font-size: 13px; color: var(--primary-dark); list-style: none; }
.cc-sec > summary::-webkit-details-marker { display: none; }
.cc-sec > summary::before { content: "▸ "; color: var(--muted-2); }
.cc-sec[open] > summary::before { content: "▾ "; }
.cc-text { margin-top: 7px; font-size: 13.5px; line-height: 1.8; color: var(--text); white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow: auto; padding: 9px 11px; background: #f8fafc; border-radius: 8px; }
.cl-empty { margin-top: 9px; font-size: 12.5px; color: var(--amber); background: var(--amber-bg); border-radius: 7px; padding: 7px 10px; }
.cl-label { margin-top: 12px; font-size: 12.5px; font-weight: 500; color: var(--muted); letter-spacing: 0.3px; }
.cc-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.cc-ro { font-size: 12.5px; color: var(--muted); align-self: center; }
.cc-loading { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--muted); padding: 14px 2px; }

/* ---------- AI 质检结果 ---------- */
.cc-an { margin-top: 12px; padding: 13px 14px; border-radius: var(--radius); background: #f8fafc; border: 1px solid var(--line); }
.an-top { display: flex; align-items: center; gap: 12px; }
.an-score { flex: 0 0 auto; width: 62px; height: 62px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 21px; font-weight: 500; line-height: 1.05; }
.an-score small { font-size: 10.5px; font-weight: 400; margin-top: 1px; }
.an-sum { font-size: 13.5px; line-height: 1.75; color: var(--text); }
.sc-good { background: var(--green-bg); color: var(--green); }
.sc-mid { background: var(--amber-bg); color: var(--amber); }
.sc-bad { background: var(--red-bg); color: var(--red); }
.an-list { list-style: none; margin: 6px 0 0; padding: 0; }
.an-list li { position: relative; padding: 6px 0 6px 0; font-size: 13.5px; line-height: 1.75; color: var(--text); border-top: 1px solid #eef2f6; }
.an-list li:first-child { border-top: none; }
.an-list.plain li { padding-left: 14px; }
.an-list.plain li::before { content: "·"; position: absolute; left: 3px; color: var(--primary); font-weight: 700; }
.an-lv { display: inline-block; min-width: 30px; text-align: center; margin-right: 7px; padding: 1px 6px; border-radius: 5px; font-size: 11.5px; vertical-align: 1px; }
.lv-h { background: var(--red-bg); color: var(--red); }
.lv-m { background: var(--amber-bg); color: var(--amber); }
.lv-l { background: var(--gray-bg); color: var(--gray); }
.an-a { margin: 4px 0 0 37px; font-size: 13px; line-height: 1.7; color: var(--primary-dark); background: var(--primary-soft); border-radius: 7px; padding: 6px 10px; }
.an-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.an-tag { display: inline-block; padding: 3px 9px; border-radius: 999px; background: var(--gray-bg); color: var(--gray); font-size: 12.5px; }
.an-tag.good { background: var(--green-bg); color: var(--green); }
.an-out { margin-top: 6px; font-size: 13.5px; line-height: 1.75; color: var(--text); }

@media (max-width: 760px) {
  .an-top { flex-direction: column; align-items: flex-start; gap: 8px; }
  .an-score { width: 52px; height: 52px; font-size: 18px; }
  .an-a { margin-left: 0; }
  .cc-score { margin-left: 0; }
  .rec-text { min-height: 80px; }
}

/* ---------- 渠道统计：窄屏 ---------- */
@media (max-width: 760px) {
  .chan-cards { padding: 10px 12px 2px; gap: 8px; }
  .chan-card { flex: 1 1 calc(50% - 4px); min-width: 0; padding: 8px 11px 9px; }
  .chan-card .ch-main { font-size: 21px; }
  .chan-card .ch-sub { font-size: 11.5px; gap: 3px 8px; }
  .chan-panel .panel-head { flex-wrap: wrap; row-gap: 3px; }
  .chan-panel .panel-head .chan-total { display: none; }
  .chan-detail-head { flex-wrap: wrap; row-gap: 2px; padding: 8px 12px 6px; }
  table.chan-table th:first-child, table.chan-table td:first-child { width: auto; min-width: 92px; }
  /* 8 列在手机上必横滑：整表隐藏，换卡片式明细 */
  .chan-table-wrap { display: none; }
  .chan-mlist { display: block; padding: 2px 12px 10px; }
  /* 时间段工具条：按钮组换行显示（不截断），自定义日期单独占行 */
  .chan-toolbar { padding: 8px 12px; gap: 8px; }
  .chan-seg { flex-wrap: wrap; }
  .chan-custom { flex-wrap: wrap; }
  .chan-range-text { margin-left: 0; width: 100%; }
  /* 今日速览：数字缩小一档，渠道拆分换到下一行 */
  .today-band { margin: 8px 12px 6px; padding: 7px 11px; gap: 3px 12px; }
  .tb-m b { font-size: 17px; }
  .tb-chans { margin-left: 0; width: 100%; gap: 2px 9px; }
  .chan-trend { padding: 10px 12px 12px; }
  .trend-kpi { flex: 1 1 100%; }
  .tk-value { font-size: 21px; }
  .trend-legend { gap: 3px 10px; }
  /* 卡片内的迷你曲线在手机上压扁一点，避免卡片过高 */
  .chan-card .ch-spark { margin-top: 3px; }
  .chan-card .ch-spark svg { height: 34px; }
  .chan-card .ch-cmp-block { margin-top: 7px; }
  .ch-spark-head { font-size: 10.5px; gap: 3px; }
  .ch-k { font-size: 10px; padding: 0 4px; }
  .chan-card .ch-cmp { font-size: 11px; gap: 4px; }
}

/* ---------- 就诊数据导入（管理员工作台） ---------- */
.imp-panel {
  display: flex; align-items: center; gap: 14px; margin-bottom: 12px;
  padding: 12px 16px; background: var(--panel);
  border: 1px solid var(--line); border-left: 3px solid var(--primary);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.imp-ico {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 10px;
  background: var(--primary-soft); color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center; font-size: 19px;
}
.imp-txt { flex: 1 1 auto; min-width: 0; }
.imp-title { font-size: 14.5px; font-weight: 600; }
.imp-sub { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin-top: 1px; }
.imp-sub b { color: var(--text); font-weight: 600; }
.imp-side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.imp-last { font-size: 11.5px; color: var(--muted-2); text-align: right; line-height: 1.45; }
.imp-side .btn { white-space: nowrap; }

/* 导入弹窗 */
.imp-guide {
  font-size: 12.5px; color: var(--muted); line-height: 1.6;
  background: #f7fbfd; border: 1px solid #dcecf2; border-radius: 8px;
  padding: 9px 12px; margin-bottom: 12px;
}
.imp-guide b { color: var(--text); }
.imp-file { width: 100%; padding: 7px 9px; border: 1px dashed var(--line-strong); border-radius: 8px; background: #fff; font-size: 13px; }
.imp-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 10px 0 12px; }
.imp-date { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.imp-date input { padding: 5px 8px; border: 1px solid var(--line-strong); border-radius: 7px; font-size: 12.5px; }
.imp-sub-title { font-size: 13px; font-weight: 600; margin: 14px 0 7px; }
.imp-sub-title .muted { font-weight: 400; font-size: 12px; }
.imp-map { display: flex; flex-wrap: wrap; gap: 8px 12px; }
.imp-map label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.imp-map select {
  padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 7px;
  background: #fff; font-size: 12.5px; color: var(--text); min-width: 128px;
}
.imp-preview { border: 1px solid var(--line); border-radius: 8px; overflow: auto; max-height: 190px; }
.imp-preview table.data { margin: 0; }
.imp-preview th, .imp-preview td { font-size: 12px; padding: 6px 9px; }
.vis-stat { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.vis-stat > div {
  flex: 1 1 120px; border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 11px; background: #fbfcfe;
}
.vis-stat b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; line-height: 1.25; }
.vis-stat span { font-size: 11.5px; color: var(--muted); }
.vis-stat .ok b { color: var(--green); }
.vis-stat .warn b { color: var(--amber); }
.vis-range { font-size: 12px; color: var(--muted); margin-top: 8px; }
.vis-range.warn { color: var(--amber); }
/* 姓名要按医院表格更正——这条会改档案，给个底色让它别被扫过去 */
.vis-range.name-fix {
  color: #1d4ed8; background: #eff5ff; border: 1px solid #d3e2fb;
  border-radius: 6px; padding: 6px 9px; line-height: 1.6;
}
.vis-range.name-fix b { color: #1e3a8a; }
.imp-unwrap { display: flex; flex-wrap: wrap; gap: 6px; }
.imp-unchip {
  font-size: 11.5px; color: var(--gray); background: var(--gray-bg);
  border-radius: 999px; padding: 2px 9px;
}
/* 列表状态列下的消费金额（住院那格的金额副行还在用） */
.amt-tag {
  margin-top: 3px; font-size: 11.5px; color: #92400e;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
/* 「累计消费」独立列：金额是重要数据，单独一列、等宽数字、不跟状态挤 */
.col-amt { white-space: nowrap; }
.amt-cell {
  font-size: 12.5px; font-weight: 700; color: #92400e;
  font-variant-numeric: tabular-nums;
}
.amt-times { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); }
/* 就诊明细里的金额标签 */
.tag-money { background: #fef7e6; color: #92400e; font-variant-numeric: tabular-nums; }

/* 是否住院：列表独立一列的小标 / 详情里的「已住院」 */
.hosp-tag {
  font-size: 11.5px; font-weight: 600; color: #1d4ed8;
  background: #eff6ff; border: 1px solid #c7dcfb; border-radius: 999px;
  padding: 0 7px; display: inline-block; white-space: nowrap;
}
.hosp-yes { color: #1d4ed8; font-weight: 600; }
/* 住院明细：左边一条蓝色竖线，跟门诊（绿）区分开 */
.adm-tl .tl-item.hosp { border-left-color: #3b82f6; }
.imp-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* 自动识别结果：认出来的列直接摆给你看，不用逐列核对 */
.imp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.imp-chip {
  display: inline-flex; align-items: baseline; gap: 5px; max-width: 100%;
  font-size: 12px; background: #f2f8f5; border: 1px solid #cfe6da;
  border-radius: 999px; padding: 3px 10px;
}
.imp-chip b { font-weight: 600; color: #14603a; white-space: nowrap; }
.imp-chip em {
  font-style: normal; color: var(--muted); max-width: 128px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.imp-chip i {
  font-style: normal; font-size: 10.5px; color: #7c9a8c;
  border-left: 1px solid #cfe6da; padding-left: 5px; white-space: nowrap;
}
.imp-chip.miss { background: #fff7ed; border-color: #f6d8b0; }
.imp-chip.miss b { color: #b45309; }
.imp-chip.miss i { border: 0; padding-left: 0; color: #b45309; }
/* 消费金额单独标一下：这块是用户最容易核错的（医院表里「收费」两字有好几列） */
.imp-chip.money { background: #f0f7ff; border-color: #c9ddf6; }
.imp-chip.money b { color: #1d4f8f; }
.imp-chip.money i { border-left-color: #c9ddf6; color: #6b87a8; }
.imp-auto {
  font-size: 11.5px; font-weight: 600; color: #14603a; background: #e9f6ef;
  border-radius: 999px; padding: 1px 9px; margin-left: 8px; vertical-align: 1px;
}
.imp-auto.bad { color: #92400e; background: #fef3e2; }
.imp-where { font-size: 11.5px; color: var(--muted-2); margin-top: 7px; line-height: 1.55; }
.imp-adv { margin-top: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fafcfe; }
.imp-adv > summary {
  cursor: pointer; list-style: none; padding: 7px 11px;
  font-size: 12.5px; color: var(--muted);
}
.imp-adv > summary::-webkit-details-marker { display: none; }
.imp-adv > summary::before { content: '▸'; margin-right: 5px; color: var(--muted-2); }
.imp-adv[open] > summary::before { content: '▾'; }
.imp-adv > summary:hover { color: var(--primary-dark); }
.imp-adv > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.imp-adv[open] > summary { border-bottom: 1px dashed var(--line); margin-bottom: 9px; }
.imp-adv > .imp-map { padding: 0 11px 11px; }

@media (max-width: 860px) {
  .imp-panel { flex-wrap: wrap; padding: 12px 13px; gap: 10px; }
  .imp-ico { width: 32px; height: 32px; font-size: 16px; }
  /* 手机上导入面板改为上下排：摘要一行、两个按钮并排一行（并排会跟文字抢宽度） */
  .imp-side { width: 100%; flex-direction: column; align-items: stretch; gap: 8px; }
  .imp-last { text-align: left; }
  .imp-side .btn { flex: 0 0 auto; }
  .imp-btns { width: 100%; justify-content: flex-start; }
  .imp-btns .btn { flex: 1 1 0; }
  .imp-map select { min-width: 0; width: 100%; }
  .imp-map label { flex: 1 1 46%; }
  .vis-stat > div { flex: 1 1 45%; }
  .imp-chip em { max-width: 88px; }
  .imp-auto { display: inline-block; margin: 4px 0 0; }
}
