:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #1c2430;
  --muted: #5d6877;
  --border: #dde2e8;
  --accent: #1f6f8b;
  --accent-weak: #e3f0f4;
  --warn: #9a5b00;
  --warn-weak: #fff3dd;
  --danger: #a3262a;
  --danger-weak: #fde8e8;
  --ok: #2f7a3e;
  --ok-weak: #e3f3e6;
  --info: #2f62c8;
  --info-weak: #e6eefc;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 40, 0.06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161b;
    --surface: #1a2027;
    --surface-2: #222a33;
    --text: #e6eaef;
    --muted: #9aa5b2;
    --border: #2e3843;
    --accent: #6cb7d1;
    --accent-weak: #1d3640;
    --warn: #f0b45a;
    --warn-weak: #3a2c14;
    --danger: #f08a8d;
    --danger-weak: #3d1d1f;
    --ok: #7cc58b;
    --ok-weak: #1c3322;
    --info: #84aef5;
    --info-weak: #1c2a44;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12161b; --surface: #1a2027; --surface-2: #222a33; --text: #e6eaef; --muted: #9aa5b2; --border: #2e3843;
  --accent: #6cb7d1; --accent-weak: #1d3640; --warn: #f0b45a; --warn-weak: #3a2c14; --danger: #f08a8d; --danger-weak: #3d1d1f; --ok: #7cc58b; --ok-weak: #1c3322; --info: #84aef5; --info-weak: #1c2a44;
  color-scheme: dark;
}

* { box-sizing: border-box; }
/* closed chat panel and drawer are display:none, not moved off-screen: phone browsers
   (企业微信 included) widen the layout to fit off-screen fixed elements */
html { overflow-x: hidden; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.55 -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}
button, input, select, textarea { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); font-size: 13px; }

.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px 6px;
}
.brand-name { font-size: 20px; font-weight: 700; line-height: 1.3; }
.brand-sub { font-size: 12px; color: var(--muted); }
.who { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
/* 切换经理: an avatar with the native picker laid over it */
.me { position: fixed; z-index: 11; left: 0; top: 12px; width: var(--rail-w); display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
.me-avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; font-size: 18px; font-weight: 600; }
.me-name { font-size: 12px; color: var(--muted); white-space: nowrap; }
.me select { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.me:hover .me-avatar, .me:focus-within .me-avatar { box-shadow: 0 0 0 3px var(--accent-weak); }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.chip.on { background: var(--accent-weak); color: var(--accent); }

/* 页面菜单: a fixed rail on the far left; a bottom bar on a phone */
body { padding-left: var(--rail-w); }
:root { --rail-w: 76px; }
.rail { position: fixed; z-index: 10; left: 0; top: 0; bottom: 0; width: var(--rail-w); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 92px 0 14px; background: var(--surface); border-right: 1px solid var(--border); }
.rail button { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 64px; padding: 8px 0 6px; border: 0; border-radius: 12px; background: none; color: var(--muted); font-size: 12px; line-height: 1.2; cursor: pointer; }
.rail button:hover { background: var(--surface-2); color: var(--text); }
.rail button.active { background: var(--accent-weak); color: var(--accent); font-weight: 600; }
.rail svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.rail-gap { flex: 1; }
.me-settings { display: none; }
@media (max-width: 760px) {
  body { padding-left: 0; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  /* --vh 由 app.js 按 window.innerHeight 设置：企业微信等内置浏览器里，底部工具栏会盖住 bottom:0 的导航，滑动后才露出来 */
  .rail { top: var(--rail-top, auto); bottom: var(--rail-bottom, 0); right: 0; width: auto; height: calc(64px + env(safe-area-inset-bottom)); flex-direction: row; justify-content: space-around; gap: 0; padding: 4px 4px env(safe-area-inset-bottom); border-right: 0; border-top: 1px solid var(--border); }
  .rail button { width: auto; flex: 1; min-width: 0; padding: 6px 0; border-radius: 10px; font-size: 11px; }
  .rail button.active { background: none; }
  .rail-gap { display: none; }
  /* 手机底部菜单只留 4 项：个人设置在头像旁，管理后台只在电脑上 */
  .rail button[data-tab="settings"], .rail button[data-tab="admin"] { display: none; }
  .me-settings { display: grid; place-items: center; position: absolute; z-index: 11; right: 132px; top: 16px; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--muted); }
  .me-settings svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .topbar, .md-brand { padding-right: 176px; }
  .me { position: absolute; left: auto; right: 16px; top: 16px; width: auto; flex-direction: row; gap: 6px; }
  .me-avatar { width: 32px; height: 32px; font-size: 14px; }
  .me-name { color: var(--text); }
  html body .chat-fab { bottom: calc(76px + env(safe-area-inset-bottom)); }
}

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; align-items: start; }
main { max-width: 860px; width: 100%; margin: 0 auto; padding: 16px; min-width: 0; }
@media (max-width: 1099px) {
  .layout { display: block; }
}
.seg { display: inline-flex; gap: 0; margin-bottom: 12px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 6px 14px; cursor: pointer; color: var(--muted); font-size: 13px; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.active { background: var(--accent-weak); color: var(--accent); font-weight: 600; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.crumbs .linkbtn { padding: 0 2px; font-size: 13px; }
td.below { background: var(--warn-weak); color: var(--warn); font-weight: 600; }
tr.total td { font-weight: 600; border-top: 2px solid var(--border); }
td .linkbtn { padding: 0; font-size: 13px; }
.kpi .tag { display: inline-block; margin-top: 4px; }
.kpis.wide { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.defs { margin-top: 8px; }
.signals { margin: 8px 0; padding-left: 20px; }
.signals li { margin: 4px 0; }
.insight.coaching { border-left-color: var(--warn); }
.insight.covisit { border-left-color: var(--warn); }
pre.report { white-space: pre-wrap; font-family: inherit; font-size: 14px; background: var(--surface-2); border-radius: 8px; padding: 12px; margin: 8px 0; }
.trends { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.trends > div { border-radius: 8px; transition: background .3s; }
.trends > div.flash { background: var(--accent-weak); }
.tmark { cursor: pointer; }
.tmark circle { fill: var(--warn-weak); stroke: var(--warn); }
.tmark text { fill: var(--warn); font-weight: 600; }
.tmark:hover circle, .tmark:focus circle { fill: var(--warn); }
.tmark:hover text, .tmark:focus text { fill: var(--surface); }
.tmark:focus { outline: none; }
.tlegend { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 8px; }
.tlegend > div { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 3px 0; }
.tmark-n { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--warn-weak); color: var(--warn); border: 1px solid var(--warn); font-size: 11px; font-weight: 600; }
.spark { display: block; margin-top: 6px; padding: 0; border: 0; background: none; cursor: pointer; line-height: 0; }
.spark svg { width: 96px; height: 24px; }
.spark:hover svg, .spark:focus-visible svg { filter: drop-shadow(0 0 2px var(--accent)); }
details.card summary { cursor: pointer; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card h2 { font-size: 15px; margin: 0 0 8px; }
h1.brief-title { font-size: 16px; margin: 0 0 8px; }
.brief-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.scope-chip { padding: 1px 8px; border-radius: 999px; background: var(--accent-weak); color: var(--accent); font-weight: 600; }
.brief-head h1.brief-title { font-size: 20px; margin: 0; }
.brief-head .notice { margin-bottom: 0; }
.overview p { margin: 2px 0; }
.notice { background: var(--warn-weak); color: var(--warn); padding: 8px 12px; border-radius: 8px; margin: 8px 0; font-size: 14px; }
.section-label { margin: 18px 0 8px; font-weight: 600; }

.insight { border-left: 3px solid var(--accent); }
.insight.compliance { border-left-color: var(--danger); }
.insight-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.insight-no { font-weight: 700; color: var(--accent); }
.insight.compliance .insight-no { color: var(--danger); }
.insight-title { font-weight: 600; }
.tag { font-size: 12px; padding: 1px 6px; border-radius: 4px; background: var(--surface-2); color: var(--muted); }
.tag.compliance { background: var(--danger-weak); color: var(--danger); }
.tag.channel-mc { background: var(--accent-weak); color: var(--accent); }
td.ways { white-space: nowrap; }
.insight-body { margin: 6px 0; }
.insight-action { margin: 6px 0; padding: 6px 10px; background: var(--accent-weak); border-radius: 6px; font-size: 14px; }
.insight-tasks { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.btn.primary-outline { border-color: var(--accent); color: var(--accent); }
.tag.sent, .tag.fu-done { background: var(--accent-weak); color: var(--accent); }
.tag.fu-pending { background: var(--warn-weak); color: var(--warn); }
.followup { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; padding: 6px 0; font-size: 14px; }
.followup + .followup { border-top: 1px solid var(--border); }
#task-message { font-family: inherit; font-size: 14px; line-height: 1.6; color: var(--text); }
.insight-foot { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.insight-foot .defs { width: 100%; font-size: 12px; color: var(--muted); margin-top: 2px; }
.insight-foot details.defs summary { cursor: pointer; width: max-content; }
.btn.quiet { border-color: transparent; background: none; color: var(--muted); padding: 5px 6px; }
.btn.quiet:hover { color: var(--text); }
.doc-list { margin: 6px 0; padding: 0; list-style: none; font-size: 14px; }
.doc-list li { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; padding: 5px 0; }
.doc-list li + li { border-top: 1px dashed var(--border); }
.insight-action > div + div { margin-top: 4px; }

.btn, button.primary, .linkbtn {
  border: 1px solid var(--border); background: var(--surface); padding: 5px 10px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-theme="dark"] button.primary { color: #0d1b21; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) button.primary { color: #0d1b21; } }
.linkbtn { border-color: transparent; color: var(--accent); padding: 4px 6px; }
.btn.chosen { background: var(--accent-weak); color: var(--accent); border-color: var(--accent); }

/* 对话侧栏: beside the page on wide screens, a toggled overlay on narrow ones */
.chat-panel {
  display: flex; flex-direction: column; gap: 10px; background: var(--surface); border-left: 1px solid var(--border);
  padding: 12px 14px; position: sticky; top: 0; height: calc(100vh - 100px); min-width: 0;
}
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.chat-close { display: block; border: 0; background: none; font-size: 18px; cursor: pointer; color: var(--muted); }
.chat-fab { display: none; }
@media (max-width: 1099px) {
  .chat-panel {
    display: none; position: fixed; inset: 0 0 auto auto; top: 0; width: min(440px, 100%);
    height: var(--app-h, 100vh); z-index: 15; box-shadow: -4px 0 16px rgba(0, 0, 0, 0.12);
  }
  body.chat-open .chat-panel { display: flex; }
  body .chat-fab {
    display: block; position: fixed; right: 16px; bottom: 16px; z-index: 12; border: 0; border-radius: 999px;
    padding: 10px 16px; background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); cursor: pointer;
  }
  body.chat-open .chat-fab { display: none; }
  .chat-close { width: 44px; height: 44px; margin: -8px -10px -8px 0; font-size: 22px; }
}
.messages { position: relative; flex: 1; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 0; }
.msg { max-width: 92%; padding: 10px 12px; border-radius: 12px; white-space: pre-wrap; word-break: break-word; }
.msg.user { align-self: flex-end; background: var(--accent); color: #fff; }
:root[data-theme="dark"] .msg.user { color: #0d1b21; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .msg.user { color: #0d1b21; } }
.msg.bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); }
.msg .meta { margin-top: 8px; font-size: 12px; color: var(--muted); white-space: normal; }
.msg details { margin-top: 6px; font-size: 12px; color: var(--muted); white-space: normal; }
.msg .warn { margin-top: 6px; font-size: 13px; color: var(--warn); white-space: normal; }
.suggestions { display: flex; gap: 6px; flex-wrap: wrap; }
.suggestions button { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 4px 10px; font-size: 13px; cursor: pointer; }
.chat-form { display: flex; gap: 8px; background: var(--surface); padding: 4px 0 0; }
.chat-form input { flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.chat-form button { padding: 0 16px; border-radius: 10px; border: 0; background: var(--accent); color: #fff; }

.tbl-wrap { overflow-x: auto; margin-top: 8px; white-space: normal; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.quotes { margin: 8px 0 0; padding: 0; list-style: none; white-space: normal; }
.quotes li { margin: 4px 0; padding-left: 10px; border-left: 2px solid var(--border); font-size: 14px; }
.chart { margin-top: 8px; white-space: normal; }
.chart svg { width: 100%; height: auto; max-width: 420px; }
.chart svg text { paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.chart svg .tmark text { stroke: none; }

.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: min(520px, 100%); background: var(--surface);
  border-left: 1px solid var(--border); z-index: 20;
  display: none; flex-direction: column;
}
.drawer.open { display: flex; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { margin: 0; font-size: 15px; }
.drawer-head button { border: 0; background: none; font-size: 18px; cursor: pointer; color: var(--muted); }
.drawer-body { padding: 12px 16px; overflow-y: auto; }
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.3); display: none; z-index: 10; }
.scrim.open { display: block; }
.record { padding: 10px 0; border-bottom: 1px solid var(--border); }
.record-head { font-size: 13px; color: var(--muted); }
.record-note { margin: 4px 0; }
.record-note mark { background: var(--warn-weak); color: inherit; padding: 0 2px; }
.record-tags { display: flex; gap: 4px; flex-wrap: wrap; }

.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; margin: 10px 0; }
textarea { width: 100%; font: 12px/1.5 ui-monospace, Menlo, monospace; padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.row { display: flex; gap: 10px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.kpi { background: var(--surface-2); border-radius: 8px; padding: 10px; }
.kpi .v { font-size: 20px; font-weight: 600; }
.kpi .l { font-size: 12px; color: var(--muted); }
.good { color: var(--ok); }
.bad { color: var(--danger); }
.errors { color: var(--danger); font-size: 13px; }
@media (max-width: 560px) {
  main { padding: 12px 16px; }
  .msg { max-width: 100%; }
}
#drawer-body h3 { font-size: 14px; margin: 14px 0 2px; }
#drawer-body .legend { margin: 0 0 6px; padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; }
.filters label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.filters select { padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 14px; max-width: 100%; }
.tag.up { background: var(--warn-weak); color: var(--warn); }
.dist { margin-top: 8px; }
.th-sort { all: unset; cursor: pointer; color: inherit; font: inherit; }
.th-sort:hover, .th-sort.active { color: var(--text); text-decoration: underline; }
.th-sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* 指标区块：核心区 + 全部指标（分类折叠） */
.kpi { position: relative; }
.kpi-tools { position: absolute; top: 4px; right: 4px; display: flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.kpi:hover .kpi-tools, .kpi:focus-within .kpi-tools { opacity: 1; }
@media (hover: none) { .kpi-tools { opacity: 1; } }
.iconbtn { border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 4px; width: 22px; height: 22px; line-height: 18px; padding: 0; cursor: pointer; font-size: 14px; }
.iconbtn:hover { color: var(--text); }
details.allm { margin-top: 16px; }
details.allm > summary, details.mgroup > summary { cursor: pointer; padding: 4px 0; list-style: none; font-weight: 600; }
details.allm > summary::-webkit-details-marker, details.mgroup > summary::-webkit-details-marker { display: none; }
details.allm > summary { font-size: 14px; }
details.allm:not([open]) > summary::after, details.mgroup:not([open]) > summary::after { content: ' …'; color: var(--muted); font-weight: 400; }
details.mgroup { margin: 10px 0; }
details.mgroup > summary { font-size: 13px; color: var(--muted); }
.mtable { table-layout: fixed; min-width: 520px; }
.chg { font-weight: 600; }
.kpi .chg { font-size: 13px; margin-left: 4px; }
.chg.good { color: var(--ok); }
.chg.warn { color: var(--warn); }
.chg.bad { color: var(--danger); }
td.chg.good { background: var(--ok-weak); }
td.chg.warn { background: var(--warn-weak); }
td.chg.bad { background: var(--danger-weak); }
.muted .chg { padding: 0 3px; border-radius: 3px; }
.muted .chg.good { background: var(--ok-weak); } .muted .chg.warn { background: var(--warn-weak); } .muted .chg.bad { background: var(--danger-weak); }
.warn-text { color: var(--warn); }
table.mtable td:first-child { width: 28px; }
.star { all: unset; cursor: pointer; font-size: 16px; color: var(--muted); padding: 0 4px; }
.star.on { color: var(--accent); }
.star:disabled { cursor: default; opacity: .5; }
.star:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dist-bars { display: grid; gap: 4px; padding: 4px 0; }
.dist-bar { display: grid; grid-template-columns: minmax(64px, 120px) 1fr 52px; gap: 8px; align-items: center; font-size: 13px; }
.dist-bar .bar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.dist-bar .bar span { display: block; height: 100%; background: var(--accent); }
.core-list { margin: 8px 0; padding-left: 20px; }
/* 团队执行: block list on the left (title, count, one-line summary), the
   chosen block on the right; on a phone the list and the block are two screens */
/* 团队执行、医生声音 (参照会话列表的样式): full-height columns — the block list
   (white, with the product name on top), then the chosen block with its own
   header bar; the 月份 sits on the right of that bar */
:is(body[data-page="execution"], body[data-page="voice"], body[data-page="coaching"]) .topbar { display: none; }
:is(body[data-page="execution"], body[data-page="voice"], body[data-page="coaching"]) main { max-width: none; padding: 0; }
@media (min-width: 1100px) { :is(body[data-page="execution"], body[data-page="voice"], body[data-page="coaching"]) .chat-panel { height: 100vh; } }
.chat-head > div:first-child { flex: 1; }
.md { display: grid; grid-template-columns: 320px minmax(0, 1fr); align-items: start; min-height: 100vh; }
.md-list { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--border); padding: 0 8px 16px; }
.md-brand { font-size: 20px; font-weight: 700; padding: 18px 12px 6px; }
.md-list .crumbs { padding: 0 12px; }
.md-group { font-size: 12px; color: var(--muted); padding: 16px 12px 6px; }
.md-item { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; border: 0; border-radius: 12px; background: none; padding: 10px 12px; cursor: pointer; color: var(--text); font: inherit; }
.md-item:hover { background: var(--surface-2); }
.md-item.active { background: var(--accent-weak); }
.md-icon { flex: none; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-weak); color: var(--accent); }
.md-icon.warn { background: var(--warn-weak); color: var(--warn); }
.md-item.active .md-icon { background: var(--surface); }
.md-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.md-text { flex: 1; min-width: 0; padding-bottom: 10px; border-bottom: 1px solid var(--border); margin-bottom: -10px; }
.md-item.active .md-text, .md-item:hover .md-text { border-bottom-color: transparent; }
.md-head { display: flex; align-items: baseline; gap: 8px; }
.md-head b { flex: 1; font-size: 14px; font-weight: 600; }
.md-item.active .md-head b { color: var(--accent); }
.md-count { font-size: 12px; color: var(--muted); }
.md-count:not(.zero) { color: var(--accent); font-weight: 600; }
.md-sum { margin-top: 2px; font-size: 13px; color: var(--muted); line-height: 1.45; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.md-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); margin-right: 6px; vertical-align: 1px; }
.md-detail { min-width: 0; }
.md-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.md-bar .md-icon { width: 44px; height: 44px; }
.md-title { flex: 1 1 20em; min-width: 0; }
.md-title h1 { font-size: 14px; margin: 0; line-height: 1.3; }
.md-title .muted { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.md-bar .seg { margin: 0; max-width: 100%; overflow-x: auto; }
.md-bar .seg button { white-space: nowrap; }
.md-back { display: none; border: 0; background: none; font-size: 26px; line-height: 1; padding: 0 4px; cursor: pointer; color: var(--text); }
.md-body { padding: 20px 24px; }
/* every block fills the pane like 拜访情况: no card frame; several cards
   (需要关注) are split by a rule instead */
.md-body > .card { background: none; border: 0; border-radius: 0; box-shadow: none; padding: 0; margin: 0; }
.md-body > .card + .card { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 16px; }
.md-body > .card.insight { border-left: 3px solid var(--accent); padding-left: 12px; }
.md-body > .card.insight.compliance { border-left-color: var(--danger); }
.sub-panel { display: none; }
.sub-panel.active { display: block; }
@media (max-width: 760px) {
  :is(body[data-page="execution"], body[data-page="voice"], body[data-page="coaching"]) main { padding: 0; }
  .md { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .md-list { position: static; height: auto; border-right: 0; }
  .md .md-detail, .md.show-detail .md-list { display: none; }
  .md.show-detail .md-detail { display: block; }
  .md-item.active { background: none; }
  .md-item.active .md-icon { background: var(--accent-weak); }
  .md-item.active .md-head b { color: var(--text); }
  .md-back { display: block; }
  body.md-open:is([data-page="execution"], [data-page="voice"], [data-page="coaching"]) .me { display: none; }
  .md-bar { flex-wrap: wrap; padding: 10px 12px; }
  .md-bar .seg { width: 100%; display: flex; }
  .md-bar .seg button { flex: 1; }
  .md-body { padding: 12px; }
}
/* 医生声音: the list rows carry the numbers (share bar + change), so the
   list alone shows which objections are rising */
.vf { margin: 4px 12px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.vf summary { display: flex; align-items: baseline; gap: 8px; padding: 7px 10px; cursor: pointer; font-size: 13px; list-style: none; }
.vf summary::-webkit-details-marker { display: none; }
.vf summary::after { content: '▾'; margin-left: auto; color: var(--muted); }
.vf[open] summary::after { content: '▴'; }
.vf-label { color: var(--muted); flex: none; }
.vf-picked { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.vf-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 2px 10px 10px; border-top: 1px solid var(--border); padding-top: 8px; }
.vf label, .vf-field { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.vf select { width: 100%; min-width: 0; padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 14px; }
.vf .seg { margin: 0; display: flex; }
.vf .seg button { flex: 1; }
/* 整体概览 is the right side on a wide screen; on a phone it is a list row */
.vp-ov-row { display: none; }
#voice .md-back:not(.vp-ov-back) { display: block; }
.vo-atts { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.vo-att { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.vo-att b { font-size: 20px; }
.vo-conc { margin: 8px 0 0; padding: 0; list-style: none; }
.vo-conc li > span.muted { white-space: nowrap; }
.vo-conc li { padding: 6px 0; font-size: 14px; }
.vo-conc li > span.muted { margin-left: 6px; }
.vo-conc li > div.muted { margin-top: 2px; font-size: 13px; }
.linkbtn.vo-link { text-align: left; background: none; padding: 0; font-size: 14px; }
@media (max-width: 760px) {
  .vp-ov-row { display: flex; }
  #voice .md-back { display: block; }
}
.vp-group { display: flex; justify-content: space-between; align-items: baseline; }
.vp-more { display: block; width: calc(100% - 24px); margin: 2px 12px 0; padding: 6px 0; border: 0; background: none; text-align: left; font-size: 13px; color: var(--accent); cursor: pointer; }
.vp-more:hover { text-decoration: underline; }
.md-item.vp .md-head { align-items: flex-start; }
.md-item.vp .md-head b { font-weight: 500; line-height: 1.45; }
.md-item.vp .md-count { white-space: nowrap; }
.vp-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12px; color: var(--muted); }
/* 三种态度各一个颜色和图标：顾虑 黄棕、想了解 蓝、认可 绿 */
.a-concern { --att: var(--warn); --att-weak: var(--warn-weak); }
.a-ask { --att: var(--info); --att-weak: var(--info-weak); }
.a-praise { --att: var(--ok); --att-weak: var(--ok-weak); }
.att-ic { flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--att-weak); color: var(--att); }
.att-ic svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.att { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 1px 8px 1px 3px; border-radius: 999px; line-height: 1.6; white-space: nowrap; background: var(--att-weak); color: var(--att); font-weight: 600; }
.att .att-ic { width: 18px; height: 18px; background: none; }
.att .att-ic svg { width: 13px; height: 13px; }
.vp-group.a-concern, .vp-group.a-ask, .vp-group.a-praise { margin-top: 6px; padding-top: 14px; }
.vp-gname { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--att); }
.md-item.vp[class*=" a-"] { box-shadow: inset 3px 0 0 var(--att); border-radius: 0 12px 12px 0; }
.md-item.vp[class*=" a-"] .md-count { color: var(--att); }
.md-item.vp[class*=" a-"].active { background: var(--att-weak); }
.md-item.vp[class*=" a-"].active .md-head b { color: var(--text); font-weight: 600; }
.vo-att-tile { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; background: var(--att-weak); color: var(--att); min-width: 150px; flex: 1; }
.vo-att-tile .att-ic { width: 36px; height: 36px; background: var(--surface); }
.vo-att-tile .att-ic svg { width: 20px; height: 20px; }
.vo-att-tile b { font-size: 22px; line-height: 1.1; }
.vo-att-tile .l { font-size: 12px; }
.vo-att-tile .n { font-weight: 600; font-size: 14px; }
.vd-bar .att-ic { width: 40px; height: 40px; }
.vd-bar .att-ic svg { width: 22px; height: 22px; }
.vo-concerns .bar span { background: var(--warn); }
.vp-facts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; font-size: 14px; color: var(--muted); }
.vp-mix { margin: 0; font-size: 14px; line-height: 1.7; color: var(--muted); }
.md-empty { margin: 12px; color: var(--muted); font-size: 14px; }
.vd-bar .md-title { flex: 1 1 0; }
.vd-kpis { margin-bottom: 4px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.vd-h { font-size: 14px; margin: 0 0 8px; }
.vd-dist .dist-bar { grid-template-columns: minmax(80px, 180px) 1fr 84px; }
.vd-dist .dist-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vd-dist .num { text-align: right; font-variant-numeric: tabular-nums; }
.vd-more summary { cursor: pointer; font-size: 13px; color: var(--accent); margin: 4px 0; }
.md-body .quotes li { margin: 10px 0; line-height: 1.6; }
@media (max-width: 560px) {
  .vd-kpis { gap: 6px; }
  .vd-kpis .kpi { padding: 8px; }
  .vd-kpis .kpi .v { font-size: 16px; }
  .vd-dist .dist-bar { grid-template-columns: minmax(72px, 32%) 1fr 84px; }
}

/* 辅导页：提示状态、做得好的、协访时看什么 */
.tag.first { background: var(--accent-weak); color: var(--accent); }
.tag.streak { background: var(--warn-weak); color: var(--warn); }
.tag.cv-none { background: var(--danger-weak); color: var(--danger); }
.tag.cv-stale { background: var(--warn-weak); color: var(--warn); }
.tag.cv-watch, .tag.cv-done, .tag.good-tag { background: var(--ok-weak); color: var(--ok); }
.signals li { margin: 8px 0; }
/* 一个人的顶部：协访状态 + 操作 */
.rep-top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 12px 16px; margin-bottom: 16px; background: var(--surface-2); border-radius: var(--radius); }
.cv-strip { flex: 1 1 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; }
.cv-strip > div { display: flex; flex-direction: column; line-height: 1.35; }
.cv-strip > div .muted { font-size: 12px; }
.cv-strip b { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rep-actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* 每条提示一张卡片：结论 → 依据 → 方向 → 协访时看什么 */
.sig-title { display: flex; align-items: baseline; gap: 8px; font-size: 14px; margin: 16px 0 8px; }
.signals.cards { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 12px; }
.signals.cards > .sig { margin: 0; padding: 14px 16px; border: 1px solid var(--border); border-left: 3px solid var(--warn); border-radius: var(--radius); background: var(--surface); }
.sig-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.sig-head b { font-size: 15px; }
.sig-no { flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--warn-weak); color: var(--warn); font-size: 12px; font-weight: 600; }
.sig-ev { margin: 6px 0 8px; font-size: 14px; }
.sig-dir { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sig-dir .linkbtn { margin-left: auto; }
.tag.dir { background: var(--accent-weak); color: var(--accent); }
.observe { margin-top: 10px; font-size: 13px; }
.observe summary { cursor: pointer; color: var(--accent); }
.observe.open { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.obs-title { font-weight: 600; margin-bottom: 8px; }
.obs-sec { margin-top: 8px; }
.obs-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; font-weight: 600; color: var(--muted); font-size: 12px; margin-bottom: 2px; }
.obs-h .muted { font-weight: 400; }
.obs-sec p { margin: 0; font-size: 14px; }
.obs-docs { list-style: none; margin: 0; padding: 0; }
.obs-docs li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; padding: 3px 0; font-size: 14px; }
.obs-docs + .linkbtn { padding-left: 0; }
.obs-list { margin: 0; padding-left: 18px; font-size: 14px; }
.obs-list li { margin: 2px 0; }
.strengths { margin: 6px 0; font-size: 14px; }
.clear-reps { margin: 6px 0 0; padding-left: 18px; }
.clear-reps li { margin: 4px 0; }
.md-icon.avatar { font-size: 15px; font-weight: 600; letter-spacing: 0; background: var(--surface-2); color: var(--text); }
.md-icon.avatar.flagged { background: var(--warn-weak); color: var(--warn); }
.md-icon.avatar.off { color: var(--muted); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; margin: 0 0 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
#coaching .md-title { flex: 1 1 0; }
