/* 企微 HCRM 演示版 - 共用样式 */
:root {
  --primary: #1a7af8;
  --primary-dark: #0f5fd0;
  --wecom-green: #07c160;
  --bg: #f5f7fa;
  --card: #ffffff;
  --border: #e5e8ee;
  --text: #1f2d3d;
  --text-2: #6b7a90;
  --danger: #f56c6c;
  --warn: #e6a23c;
  --ok: #67c23a;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }

/* 布局 */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: #1e2a3a; color: #cfd8e3; flex-shrink: 0; display: flex; flex-direction: column; }
.sidebar .logo { padding: 20px 18px; font-size: 16px; font-weight: 600; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .logo small { display: block; font-weight: 400; font-size: 11px; color: #8fa1b8; margin-top: 4px; }
.sidebar nav { flex: 1; padding: 10px 0; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 11px 20px; color: #cfd8e3; text-decoration: none; font-size: 14px; border-left: 3px solid transparent; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); }
.sidebar nav a.active { background: rgba(26,122,248,.18); color: #fff; border-left-color: var(--primary); }
.sidebar .foot { padding: 14px 18px; font-size: 11px; color: #8fa1b8; border-top: 1px solid rgba(255,255,255,.08); }
.main { flex: 1; padding: 24px; min-width: 0; }

.page-title { font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.page-sub { color: var(--text-2); margin-bottom: 20px; font-size: 13px; }

/* 卡片 */
.card { background: var(--card); border-radius: 10px; border: 1px solid var(--border); padding: 18px 20px; margin-bottom: 18px; }
.card h3 { font-size: 15px; margin-bottom: 14px; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

/* 统计块 */
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 18px; }
.stat .num { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat .label { color: var(--text-2); margin-top: 4px; font-size: 13px; }
.stat.green .num { color: var(--ok); } .stat.red .num { color: var(--danger); } .stat.orange .num { color: var(--warn); }

/* 表格 */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
th { color: var(--text-2); font-weight: 500; background: #fafbfc; }
tr:hover td { background: #f8faff; }

/* 标签 */
.tag { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; margin: 2px 4px 2px 0; color: #fff; }
.tag.plain { background: #eef2f7; color: var(--text-2); }

/* 按钮 */
.btn { display: inline-block; border: none; cursor: pointer; border-radius: 6px; padding: 8px 16px; font-size: 13px; background: var(--primary); color: #fff; }
.btn:hover { background: var(--primary-dark); }
.btn.ghost { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn.sm { padding: 4px 10px; font-size: 12px; border-radius: 5px; }
.btn.green { background: var(--wecom-green); } .btn.green:hover { background: #06ad56; }
.btn.danger { background: #fff; color: var(--danger); border: 1px solid var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 表单 */
input, select, textarea { border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-size: 13px; font-family: inherit; outline: none; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
.form-row { display: flex; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
.form-item { display: flex; flex-direction: column; gap: 4px; }
.form-item label { font-size: 12px; color: var(--text-2); }

/* 状态徽标 */
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.badge.pending { background: #fdf6ec; color: var(--warn); }
.badge.done { background: #f0f9eb; color: var(--ok); }
.badge.overdue { background: #fef0f0; color: var(--danger); }
.badge.live { background: #ecf5ff; color: var(--primary); }

/* 横向条形图（纯 CSS） */
.hbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.hbar .name { width: 110px; font-size: 12px; color: var(--text-2); text-align: right; flex-shrink: 0; }
.hbar .track { flex: 1; height: 14px; background: #eef2f7; border-radius: 7px; overflow: hidden; }
.hbar .fill { height: 100%; background: linear-gradient(90deg, #4a9bff, var(--primary)); border-radius: 7px; }
.hbar .val { width: 40px; font-size: 12px; color: var(--text); }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(15,25,40,.45); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: #fff; border-radius: 12px; width: 560px; max-width: 92vw; max-height: 86vh; overflow: auto; padding: 22px 24px; }
.modal h3 { margin-bottom: 16px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* 空态 */
.empty { text-align: center; color: var(--text-2); padding: 40px 0; font-size: 13px; }

/* ---------- 医护端（仿企微）---------- */
.wx-layout { display: flex; height: 100vh; background: #f0f1f5; }
.wx-nav { width: 64px; background: #2e2e2e; display: flex; flex-direction: column; align-items: center; padding-top: 18px; gap: 22px; }
.wx-nav .avatar { width: 40px; height: 40px; border-radius: 6px; background: var(--wecom-green); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 600; }
.wx-nav .icon { width: 26px; height: 26px; opacity: .55; background-size: contain; }
.wx-session-list { width: 280px; background: #f7f7f7; border-right: 1px solid #e0e0e0; display: flex; flex-direction: column; }
.wx-session-list .search { padding: 12px; background: #fff; border-bottom: 1px solid #eee; }
.wx-session-list .search input { width: 100%; }
.wx-sessions { flex: 1; overflow-y: auto; }
.wx-session { display: flex; gap: 10px; padding: 12px 14px; cursor: pointer; border-bottom: 1px solid #f0f0f0; }
.wx-session:hover, .wx-session.active { background: #e8e8e8; }
.wx-session .ava { width: 42px; height: 42px; border-radius: 6px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.wx-session .meta { flex: 1; min-width: 0; }
.wx-session .meta .name { font-size: 14px; font-weight: 500; display: flex; justify-content: space-between; }
.wx-session .meta .name .time { font-weight: 400; font-size: 11px; color: #999; }
.wx-session .meta .last { font-size: 12px; color: #999; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.wx-chat { flex: 1; display: flex; flex-direction: column; background: #f5f5f5; }
.wx-chat-header { padding: 14px 20px; background: #f7f7f7; border-bottom: 1px solid #e0e0e0; font-size: 15px; font-weight: 500; }
.wx-msgs { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.wx-msg { display: flex; gap: 10px; max-width: 70%; }
.wx-msg .ava { width: 36px; height: 36px; border-radius: 5px; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.wx-msg.patient .ava { background: #5a8fd8; } .wx-msg.doctor .ava { background: var(--wecom-green); }
.wx-msg.doctor { align-self: flex-end; flex-direction: row-reverse; }
.wx-msg .bubble { background: #fff; border-radius: 6px; padding: 10px 12px; font-size: 14px; line-height: 1.55; box-shadow: 0 1px 1px rgba(0,0,0,.04); }
.wx-msg.doctor .bubble { background: #95ec69; }
.wx-msg .ts { font-size: 11px; color: #aaa; margin-top: 4px; }
.wx-input { background: #f7f7f7; border-top: 1px solid #e0e0e0; padding: 12px; display: flex; gap: 10px; }
.wx-input input { flex: 1; }
.wx-sidebar { width: 340px; background: #fff; border-left: 1px solid #e0e0e0; overflow-y: auto; }
.wx-sidebar .section { padding: 14px 16px; border-bottom: 1px solid #f0f0f0; }
.wx-sidebar .section h4 { font-size: 13px; color: var(--text-2); margin-bottom: 10px; }
.wx-sidebar .kv { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; }
.wx-sidebar .kv .k { color: var(--text-2); }
.path-step { display: flex; gap: 10px; padding: 6px 0; font-size: 12px; align-items: baseline; }
.path-step .dot { width: 8px; height: 8px; border-radius: 50%; background: #ddd; flex-shrink: 0; position: relative; top: -1px; }
.path-step.done .dot { background: var(--wecom-green); }
.path-step.current .dot { background: var(--primary); box-shadow: 0 0 0 3px rgba(26,122,248,.2); }
.path-step.current .action { font-weight: 600; }

/* 路径步骤编辑：步骤卡片 + 挂载推送内容 */
.step-card { border: 1px solid #e3e9f2; border-radius: 10px; padding: 10px 12px 6px; margin-bottom: 10px; background: #fafbfd; }
.step-card > .form-row { margin-bottom: 4px; }
.content-edit { background: #fff; border: 1px solid #e3e9f2; border-radius: 8px; padding: 8px 10px; margin: 0 0 8px 34px; }
.content-edit .content-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.content-edit textarea { width: 100%; box-sizing: border-box; font-size: 12px; line-height: 1.5; padding: 6px 8px; border: 1px solid #dfe6ef; border-radius: 6px; resize: vertical; font-family: inherit; }
.step-ct { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 4px 18px; }
.step-ct span { font-size: 11px; color: #4a6a8f; background: #eef4fb; border-radius: 4px; padding: 1px 6px; }
.step-ct a { color: var(--primary); text-decoration: none; }
