:root {
  --ink: #1f2933;
  --muted: #5f6b76; /* 对比度：白底 5.45、页面底色 5.03、灰标签 4.81（O-8） */
  --line: #e3e7eb;
  --bg: #f4f6f8;
  --card: #ffffff;
  --primary: #1d5fd1;
  --primary-soft: #e8f0fd;
  --ok: #1a7a44;
  --ok-soft: #e6f5ec;
  --warn: #95600f;
  --warn-soft: #fdf4e3;
  --bad: #c53030;
  --bad-soft: #fdecec;
  --radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--ink);
  /* 字号跟着浏览器和系统的字号设置走（O-8）：默认 16px 时这里是 15px，和原来一样；其他字号都用 rem */
  font-size: 93.75%;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 6px 12px; }
button:hover { border-color: #c8d0d8; }
button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover { filter: brightness(1.05); }
button.ghost { background: transparent; border-color: transparent; color: var(--primary); padding: 6px 8px; }
button:disabled { opacity: .55; cursor: default; }
input, select, textarea { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; width: 100%; }
textarea { resize: vertical; min-height: 96px; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h2 { font-size: 1.0667rem; }
h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.small { font-size: 0.8667rem; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 0.8rem; background: var(--primary-soft); color: var(--primary); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.grey { background: #eef1f4; color: var(--muted); }
.reason { font-size: 0.8667rem; padding-left: 10px; border-left: 3px solid var(--warn); color: #5c4a1e; }
.reason.bad { border-color: var(--bad); color: #7a2323; }
.reason.task { border-color: var(--primary); color: #1c3f7a; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.error { color: var(--bad); font-size: 0.8667rem; }
.notice { background: var(--primary-soft); color: #1c3f7a; border-radius: 10px; padding: 10px 12px; font-size: 0.8667rem; }
.notice.private { background: #f0eefb; color: #4b3c8f; }
.loading { color: var(--muted); font-size: 0.8667rem; }
.loading::after { content: "…"; animation: dots 1s steps(3) infinite; }
@keyframes dots { 0% { content: "."; } 50% { content: ".."; } 100% { content: "..."; } }
pre.text { white-space: pre-wrap; margin: 0; font: inherit; }

/* ---------- 顶栏 ---------- */
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar .brand { font-weight: 600; }
.topbar select { width: auto; padding: 4px 8px; font-size: 0.8667rem; }

/* ---------- 销售端（手机） ---------- */
.phone { max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--bg); padding-bottom: 72px; position: relative; }
.phone main { padding: 14px; }
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; display: flex; background: var(--card); border-top: 1px solid var(--line); z-index: 5; }
.tabbar button { flex: 1; border: 0; border-radius: 0; background: transparent; padding: 10px 0 12px; font-size: 0.8667rem; color: var(--muted); }
.tabbar button.active { color: var(--primary); font-weight: 600; }
.tabbar .badge { display: inline-block; min-width: 16px; padding: 0 4px; border-radius: 99px; background: var(--bad); color: #fff; font-size: 0.7333rem; line-height: 16px; margin-left: 2px; }
.greeting h1 { font-size: 1.3333rem; }
.followup .title { font-weight: 600; }
.advice { background: #f7f9fc; border-radius: 10px; padding: 12px; font-size: 0.9333rem; }
.advice ol { margin: 6px 0; padding-left: 20px; }
.draft { background: #fff; border: 1px dashed #b9c6d6; border-radius: 8px; padding: 10px; }

.change { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; }
.change.pending { border-color: #f0c98a; background: #fffcf5; }
.change.done { opacity: .75; }
.change .diff { font-size: 1rem; }
.change .diff .old { color: var(--muted); text-decoration: line-through; }
.change .diff .new { font-weight: 600; }
.change .quote { font-size: 0.8667rem; color: var(--muted); }

.chat { display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 88%; padding: 9px 12px; border-radius: 12px; white-space: pre-wrap; font-size: 0.9333rem; }
.msg.user { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 4px; }

/* ---------- 老板端（电脑） ---------- */
.console { max-width: 1280px; margin: 0 auto; padding: 18px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpi .value { font-size: 1.7333rem; font-weight: 600; }
.kpi .label { color: var(--muted); font-size: 0.8667rem; }
.grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 14px; margin-top: 14px; align-items: start; }
table { width: 100%; border-collapse: collapse; font-size: 0.9333rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 0.8667rem; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f7f9fc; }
tr.selected td { background: var(--primary-soft); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
#boss-chat { max-height: 420px; overflow-y: auto; }
.feed .item { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 0.9333rem; }
.feed .item:last-child { border-bottom: 0; }
.detail { margin-top: 14px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 900px) {
  .grid, .detail-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- 首页 ---------- */
.landing { max-width: 720px; margin: 60px auto; padding: 0 18px; }
.landing .cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 22px; }
.landing a.card { text-decoration: none; color: inherit; display: block; }
.landing a.card:hover { border-color: var(--primary); }
@media (max-width: 600px) { .landing .cards { grid-template-columns: 1fr; } }

/* ---------- 登录 / 邀请 ---------- */
.auth { max-width: 400px; margin: 0 auto; padding: 56px 18px; }
.auth h1 { font-size: 1.6rem; margin-bottom: 4px; }
.auth form { margin: 18px 0; }

/* ---------- 顶栏：菜单、通知 ---------- */
.topbar { flex-wrap: wrap; }
.topbar #menu { position: relative; gap: 4px; }
#bell { position: relative; font-size: 1.1333rem; padding: 4px 8px; }
#bell .badge { position: absolute; top: -2px; right: -2px; min-width: 16px; padding: 0 4px; border-radius: 99px; background: var(--bad); color: #fff; font-size: 0.7333rem; line-height: 16px; }
.dropdown { position: relative; }
.dropdown summary { list-style: none; cursor: pointer; padding: 4px 8px; border-radius: 8px; font-size: 0.9333rem; }
.dropdown summary::-webkit-details-marker { display: none; }
.dropdown summary::after { content: " ▾"; color: var(--muted); }
.dropdown-body { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px; min-width: 200px; box-shadow: 0 6px 24px rgba(0, 0, 0, .08); }
.dropdown-body button { width: 100%; text-align: left; }
.panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: min(360px, 92vw); max-height: 70vh; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 24px rgba(0, 0, 0, .1); }
.notif { display: block; padding: 10px 12px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.notif:last-child { border-bottom: 0; }
.notif.unread { background: var(--primary-soft); }
.pre { white-space: pre-wrap; }

/* ---------- 老板端顶部标签 ---------- */
.toptabs { display: flex; gap: 2px; margin-left: 8px; }
.toptabs button { border: 0; background: transparent; color: var(--muted); padding: 6px 12px; }
.toptabs button.active { color: var(--primary); font-weight: 600; background: var(--primary-soft); }
tr.muted td { color: var(--muted); }

/* ---------- 弹窗 ---------- */
dialog.modal { border: 0; border-radius: 14px; padding: 18px; width: min(520px, 94vw); max-height: 90vh; overflow-y: auto; box-shadow: 0 12px 48px rgba(0, 0, 0, .2); }
dialog.modal::backdrop { background: rgba(15, 23, 42, .35); }
dialog.modal label input, dialog.modal label select, .form-grid label input { margin-top: 4px; }

/* ---------- 销售端：客户卡片里的商机 ---------- */
.opp { border-top: 1px solid var(--line); padding-top: 8px; }
#new-account { white-space: nowrap; flex-shrink: 0; }

/* 语音记一笔 */
.voice-box { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 0 4px; }
.rec-btn { width: 132px; height: 132px; border-radius: 50%; border: none; background: var(--primary); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 0.8667rem;
  box-shadow: 0 6px 18px rgba(29, 95, 209, .28); }
.rec-btn .rec-icon { font-size: 2.2667rem; line-height: 1; }
.rec-btn.recording { background: var(--bad); box-shadow: 0 0 0 0 rgba(197, 48, 48, .5); animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(197, 48, 48, .45); } 70% { box-shadow: 0 0 0 18px rgba(197, 48, 48, 0); } 100% { box-shadow: 0 0 0 0 rgba(197, 48, 48, 0); } }
.rec-sm { white-space: nowrap; }
.rec-sm.recording { background: var(--bad); border-color: var(--bad); color: #fff; }
.followup { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fbfcfd; }
.followup input { flex: 1; min-width: 0; }
button.pick { text-align: left; padding: 10px 12px; }
/* 窄屏时按钮和字段名不要被挤成竖排 */
.row > button { flex-shrink: 0; white-space: nowrap; }
.change .row > b { white-space: nowrap; }
.change .row > .muted { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 客户档案 */
.dossier { border-top: 1px solid var(--line); padding-top: 10px; }
.dossier ul { margin: 4px 0 0; padding-left: 18px; }
.dossier li { margin: 2px 0; }
.dossier details summary { cursor: pointer; }
.promise { border-radius: 8px; padding: 6px 8px; background: var(--warn-soft); }
.promise.late { background: var(--bad-soft); }
button.x { border: none; background: transparent; color: var(--muted); padding: 0 4px; font-size: 0.9333rem; }
button.x:hover { color: var(--bad); }
/* 今日安排 */
.plan-head { padding: 2px 4px; }
ol.rules { margin: 0; padding-left: 20px; }
.r-rule { width: 100%; }
/* 行程时间线 */
.trip-line { border-left: 2px solid var(--line); margin-left: 4px; padding-left: 12px; display: flex; flex-direction: column; gap: 6px; }
.trip-stop { display: flex; gap: 10px; font-size: 0.8667rem; }
.trip-time { color: var(--muted); min-width: 40px; font-variant-numeric: tabular-nums; }
/* 我的：画像、打法、模板 */
.review { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fbfcfd; }
.review ul { margin: 4px 0 0; padding-left: 18px; }
.review li.bad { color: var(--bad); }
.tpl { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.tpl .tp-name { flex: 1; font-weight: 500; }
.pre { white-space: pre-wrap; margin-top: 6px; }
#me-profile ul { margin: 4px 0 0; padding-left: 18px; }
/* 客户列表 */
.customer { cursor: pointer; }
.customer:hover { border-color: #c8d0d8; }
/* 底部导航：4 个页面 + 正中间的麦克风 */
.tabbar { align-items: flex-end; padding-bottom: env(safe-area-inset-bottom); }
.tabbar button { font-size: 0.8667rem; }
.tabbar button.mic { flex: 0 0 76px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 0 0 8px; color: var(--primary); font-weight: 600; }
.tabbar .mic-icon { width: 56px; height: 56px; margin-top: -22px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 1.7333rem;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 18px rgba(29, 95, 209, .35); border: 4px solid var(--card); }
.tabbar .mic-label { font-size: 0.7333rem; }
.tabbar button.mic:active .mic-icon { transform: scale(.95); }
/* "说一段"面板：手机上从底部弹出 */
dialog.modal.sheet { width: min(480px, 100vw); max-width: 100vw; max-height: 92vh; margin: auto auto 0; border-radius: 16px 16px 0 0; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 600px) { dialog.modal.sheet { margin: auto; border-radius: 14px; } }
dialog.sheet .rec-btn { width: 112px; height: 112px; }
/* 跳到收件箱的某个客户、日报卡片时闪一下 */
.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 3px var(--warn); } 100% { box-shadow: 0 0 0 0 transparent; } }
.center { text-align: center; }
button.link { border: 0; background: none; padding: 0; color: var(--primary); font-size: inherit; }
.me-nav { position: sticky; top: 49px; z-index: 4; background: var(--bg); padding: 4px 0; gap: 2px; }
.me-nav button { padding: 4px 8px; font-size: 0.8667rem; }
.chat-page { padding-bottom: 8px; }
/* 老板端：设置页两栏、上线检查清单 */
.settings-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px 16px; }
.check-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.check-item.done { background: var(--ok-soft); border-color: transparent; }
.check-mark { width: 22px; height: 22px; flex: 0 0 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.8667rem; font-weight: 700; background: var(--warn-soft); color: var(--warn); }
.check-item.done .check-mark { background: var(--ok); color: #fff; }
@media (max-width: 900px) { .settings-grid { grid-template-columns: 1fr; } }
/* 隐私政策、用户协议 */
.doc { max-width: 760px; margin: 0 auto; padding: 28px 18px 60px; }
.doc h1 { font-size: 1.4667rem; margin-top: 18px; }
.doc h2 { margin-top: 18px; }
.doc li { margin: 4px 0; }
.doc hr { margin: 36px 0; border: 0; border-top: 1px solid var(--line); }
/* 第一次打开的引导：被指到的地方高亮 */
.tour-spot { position: relative; z-index: 30; box-shadow: 0 0 0 4px var(--warn), 0 0 0 9999px rgba(15, 23, 42, .25) !important; border-radius: 12px; }
dialog.tour { margin-top: 18vh; }
.doc details { border-bottom: 1px solid var(--line); padding: 8px 0; }
.doc details summary { cursor: pointer; }
dialog.tour::backdrop { background: transparent; }
/* 销售管道（单系列条形图：一种蓝色，条不超过 24px，数据那头圆角、基线那头方角，数值写在条的末端） */
.viz-root { --series-1: #2a78d6; --viz-text: var(--ink); --viz-muted: var(--muted); --viz-grid: #e9ecef; }
.pipe-charts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 18px; }
@media (max-width: 900px) { .pipe-charts { grid-template-columns: 1fr; } }
.hbars { display: flex; flex-direction: column; gap: 2px; }
.hbar-row { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 8px; border: 0; background: none; padding: 4px 0; text-align: left; border-radius: 6px; }
.hbar-label { font-size: 0.8667rem; color: var(--viz-muted); }
.hbar-track { display: flex; align-items: center; gap: 6px; border-left: 1px solid var(--viz-grid); min-height: 18px; }
.hbar { height: 18px; background: var(--series-1); border-radius: 0 4px 4px 0; }
.bar-val { font-size: 0.8rem; color: var(--viz-text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.vbars { display: flex; align-items: flex-end; gap: 4px; height: 170px; border-bottom: 1px solid var(--viz-grid); padding-top: 4px; }
.vbar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; border: 0; background: none; padding: 0; border-radius: 6px; position: relative; }
.vbar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.vbar { width: min(24px, 70%); background: var(--series-1); border-radius: 4px 4px 0 0; }
.vbar-col.muted-col .vbar { opacity: .55; }
.vbar-label { position: absolute; bottom: -20px; font-size: 0.7333rem; color: var(--viz-muted); white-space: nowrap; }
.vbars + * { margin-top: 26px; }
.hbar-row:hover, .vbar-col:hover, .hbar-row:focus-visible, .vbar-col:focus-visible { background: #f3f6fb; outline: none; }
.hbar-row.picked, .vbar-col.picked { background: var(--primary-soft); }
.viz-tip { position: absolute; z-index: 50; background: #1f2933; color: #fff; font-size: 0.8rem; padding: 5px 8px; border-radius: 6px; pointer-events: none; white-space: nowrap; }
/* 销售预测 */
.forecast-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .forecast-grid { grid-template-columns: 1fr; } }
.forecast-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fc-val { font-size: 1.1333rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.fc-judge { background: #f7f9fc; border-radius: 8px; padding: 8px 10px; }
.fc-judge ul { margin: 4px 0; padding-left: 18px; }

/* ---------- 老板端在手机上（ROADMAP F-9）：不用横着滑 ---------- */
@media (max-width: 640px) {
  .console { padding: 12px 10px; }
  /* 顶栏两行：上面公司名、同步、铃铛、名字；下面五个页签铺满一行 */
  .topbar { padding: 8px 10px; gap: 6px; }
  /* 第一行：公司名占满剩下的地方，铃铛和名字固定在右边（以前字大时会掉到下一行的左边，菜单就从屏幕左边跑出去） */
  .topbar .brand { flex: 1 1 0; min-width: 0; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar #menu { flex: none; margin-left: auto; flex-wrap: nowrap; }
  /* 手机上顶栏不放"从 CRM 同步"：客户页打开时会自动拉最新的，管理员在「设置」里也能同步 */
  #sync { display: none !important; }
  /* 页签一行，放不下就横着滑，不换行 */
  .toptabs { order: 10; width: 100%; margin-left: 0; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .toptabs::-webkit-scrollbar { display: none; }
  .toptabs button { flex: 1 0 auto; padding: 6px 10px; font-size: 0.9333rem; white-space: nowrap; }
  .kpi .value { font-size: 1.4667rem; }
  .card { padding: 12px; }
  .form-grid { grid-template-columns: 1fr; }
  /* 表格：一行变成一张小卡片，第一格是标题，其余每格左边列名、右边值（列名由 boss.js 的 labelTables 记上） */
  .console table.cards-sm thead { display: none; }
  .console table.cards-sm, .console table.cards-sm tbody, .console table.cards-sm tr { display: block; width: 100%; }
  .console table.cards-sm tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  .console table.cards-sm td { display: block; overflow: hidden; border: 0; padding: 3px 2px; text-align: right; }
  .console table.cards-sm td::before { content: attr(data-label); float: left; max-width: 45%; margin-right: 12px; color: var(--muted); font-size: 0.8rem; text-align: left; }
  .console table.cards-sm td:first-child { display: block; text-align: left; font-weight: 600; }
  .console table.cards-sm td:first-child::before { content: none; }
  .console table.cards-sm td:first-child .muted { font-weight: 400; }
  .console table.cards-sm td[data-label=""]::before { content: none; }
  .console input, .console select { min-width: 0; max-width: 100%; }
  .fab:not([hidden]) { display: block; }
  #ask-card { scroll-margin-top: 118px; } /* 别被两行的顶栏挡住 */
}
.fab { display: none; position: fixed; right: 14px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 6; border: 0; border-radius: 99px; padding: 10px 16px; background: var(--primary); color: #fff; font-weight: 600; box-shadow: 0 4px 14px rgba(29, 95, 209, 0.35); }


/* ---------- 无障碍（ROADMAP O-8） ---------- */
/* 用键盘操作时看得到焦点在哪 */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* 手机上按钮至少 44 像素高，好点（行内的文字链接除外） */
@media (pointer: coarse) {
  button:not(.link) { min-height: 44px; }
  #bell { min-width: 44px; }
}
/* 系统设置了"减少动态效果"：不做动画 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
/* 字号调大时，长的词能断行，不撑出屏幕；一排按钮放不下就换行（有输入框的那排不换，免得输入框和按钮拆开） */
body { overflow-wrap: anywhere; }
.row:not(:has(> input, > textarea, > select)) { flex-wrap: wrap; }

/* ---------- 客户页：四栏、客户画像、基本资料（ROADMAP F-17） ---------- */
.seg { display: flex; gap: 4px; background: #eef1f4; border-radius: 10px; padding: 3px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 6px 0; border-radius: 8px; color: var(--muted); font-weight: 500; }
.seg button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08); }
.pf-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.pf-tag { padding: 2px 10px; border-radius: 99px; background: #eef1f4; color: var(--ink); font-size: 0.8667rem; }
.pf-sec { margin-top: 4px; }
.pf-rows { display: flex; flex-direction: column; }
/* 一项打分：名字 | 5 格 | 几个字；点开看依据。格子用一种蓝色，分低的用橙色并加"!"，不只靠颜色 */
.pf-row { display: grid; grid-template-columns: 4em auto minmax(0, 1fr); align-items: center; gap: 10px; border: 0; background: none; padding: 6px 2px; text-align: left; border-radius: 8px; color: var(--ink); font: inherit; }
.pf-row:hover { background: var(--bg); }
.pf-meter { display: inline-flex; gap: 2px; }
.pf-meter i { width: 0.9333rem; height: 0.6rem; border-radius: 2px; background: #e3e7eb; }
.pf-meter i.on { background: #2a78d6; }
.pf-meter i.on.warn { background: #b06c00; }
.pf-note { font-size: 0.9333rem; }
.pf-warn { display: inline-block; width: 1.2em; height: 1.2em; line-height: 1.2em; text-align: center; border-radius: 50%; background: var(--warn-soft); color: var(--warn); font-weight: 700; font-size: 0.8rem; margin-right: 4px; }
.pf-why { padding: 0 2px 6px calc(4em + 12px); }
.pf-by { margin-left: 4px; }
.pf-people { display: flex; flex-wrap: wrap; gap: 6px; }
.pf-person { padding: 3px 10px; border-radius: 8px; border: 1px solid var(--line); font-size: 0.8667rem; color: var(--muted); background: var(--card); }
.pf-person.good { border-color: #9fd3b3; color: var(--ok); background: var(--ok-soft); }
.pf-person.bad { border-color: #f1b5b5; color: var(--bad); background: var(--bad-soft); }
.pf-touch svg { width: 100%; height: 1.6rem; display: block; }
.pf-touch line { stroke: #c3c9cf; stroke-width: 1; }
.pf-touch circle { fill: #2a78d6; stroke: var(--card); stroke-width: 2; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; font-size: 0.9333rem; }
.btn-link { color: var(--primary); text-decoration: none; padding: 4px 6px; border-radius: 6px; white-space: nowrap; }
.btn-link:hover { background: var(--primary-soft); }
.chip-btn { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 3px 12px; font-size: 0.8667rem; color: var(--muted); }
.chip-btn[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
details.card > summary { cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- 老板端：销售的工作画像（F-18）、报表（F-19） ---------- */
.work-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px 24px; }
@media (max-width: 760px) { .work-grid { grid-template-columns: 1fr; } }
.wk-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 2px; }
.wk-legend i { display: inline-block; width: 0.6rem; height: 0.6rem; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.wk-bars { width: 100%; max-width: 22rem; height: auto; display: block; }
.wk-bars line { stroke: #c3c9cf; stroke-width: 1; }
.wk-bars .wv { font-size: 0.7rem; fill: var(--ink); }
.wk-bars .wl { font-size: 0.7rem; fill: var(--muted); }
.plan-late { color: var(--warn); }
.pf-meter.mini i { width: 0.6rem; height: 0.6rem; }
.warn-text { color: var(--warn); font-weight: 600; }
.table-scroll { overflow-x: auto; }
.report-table { width: 100%; }
.report-table td, .report-table th { white-space: nowrap; }
.report-table tfoot td { border-top: 2px solid var(--line); font-weight: 600; }
.th-sort { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.th-sort:hover { color: var(--primary); }

/* 系统管理员才看得到的（F-21）：设置、团队管理、导入。服务器上也有检查，这里只是不让人点了再报错 */
body.not-admin .admin-only { display: none !important; }
body:not(.not-admin) .not-admin-only { display: none !important; }

/* 切换账号（F-22）：一行一个账号，头像 + 名字 + 身份 */
.account-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card, #fff); }
.account-row[data-switch] { cursor: pointer; }
.account-row[data-switch]:hover { border-color: var(--primary, #1d5fd1); }
.account-row.current { opacity: 1; cursor: default; }
.account-row .avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--primary, #1d5fd1); color: #fff; font-weight: 600; }
.account-row .who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.account-row .who .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 手机上：右上角菜单和通知面板贴着屏幕右边打开，不会跑出屏幕 */
@media (max-width: 640px) {
  .dropdown-body { position: fixed; top: 56px; right: 8px; left: auto; width: min(280px, calc(100vw - 16px)); max-height: calc(100vh - 72px); overflow-y: auto; }
  .panel { position: fixed; top: 56px; right: 8px; left: 8px; width: auto; }
}

/* ======================================================================
   新样式（F-24，2026-11-29 你确认的手机版设计稿 public/design/mobile.html）
   放在最后，覆盖前面的同名样式：颜色、卡片、按钮、顶栏、底部导航，销售「今天」、客户页，老板总览、报表
   ====================================================================== */
:root {
  --bg: #f3f5f9;
  --line: #e7ecf2;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 20px rgba(15, 23, 42, .06);
  --grad: linear-gradient(135deg, #1d5fd1 0%, #3b47d8 55%, #6d3fd8 100%);
  /* 图表：见面 / 电话 / 消息三类（分类色，按顺序用）；阶段由浅到深一种蓝（有序） */
  --meet: #2a78d6; --call: #eb6834; --msg: #1baf7a;
  --st1: #86b6ef; --st2: #5598e7; --st3: #2a78d6; --st4: #1c5cab; --st5: #104281;
  --warn-dot: #fab219;
}
.card { border: 0; box-shadow: var(--shadow); }
.card .card { box-shadow: none; border: 1px solid var(--line); }
button { border-radius: 12px; }
button.primary { font-weight: 600; box-shadow: 0 4px 12px rgba(29, 95, 209, .22); }
button.ghost { background: var(--primary-soft); padding: 6px 12px; font-weight: 600; }
button.ghost:hover { filter: brightness(.98); }
button.link, .tabbar button, .toptabs button, .seg button, .pf-row, .hbar-row, .vbar-col, .th-sort, button.x { box-shadow: none; }
.chip { font-weight: 600; padding: 2px 9px; }
input, select, textarea { border-radius: 12px; }
h2 { font-size: 1.0667rem; font-weight: 700; }

/* 顶栏：半透明、毛玻璃，不要分割线 */
.topbar { background: rgba(243, 245, 249, .88); -webkit-backdrop-filter: saturate(1.6) blur(12px); backdrop-filter: saturate(1.6) blur(12px); border-bottom: 0; }
.topbar .brand { font-weight: 800; font-size: 1.0667rem; }
.dropdown summary { background: var(--card); box-shadow: var(--shadow); border-radius: 12px; padding: 6px 10px; }
#bell { border: 0; background: var(--card); box-shadow: var(--shadow); border-radius: 12px; }

/* ---------- 销售端 ---------- */
.phone { padding-bottom: 96px; }
.tabbar { background: rgba(255, 255, 255, .94); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding: 4px 6px calc(6px + env(safe-area-inset-bottom)); }
.tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 4px; font-size: 0.7333rem; border-radius: 12px; position: relative; }
.tabbar button svg { width: 24px; height: 24px; }
.tabbar button .badge { position: absolute; top: 2px; left: calc(50% + 6px); margin: 0; }
.tabbar button.mic { flex: 0 0 80px; padding-bottom: 4px; }
.tabbar .mic-icon { width: 60px; height: 60px; margin-top: -26px; background: var(--grad); border: 0; box-shadow: 0 10px 24px rgba(59, 71, 216, .45), 0 0 0 5px #fff; position: relative; }
.tabbar .mic-icon svg { width: 28px; height: 28px; color: #fff; }
.tabbar .mic-icon::after { content: ""; position: absolute; inset: 0; border-radius: 50%; animation: mic-ring 2.4s infinite; }
@keyframes mic-ring { 0% { box-shadow: 0 0 0 0 rgba(59, 71, 216, .35); } 70% { box-shadow: 0 0 0 16px rgba(59, 71, 216, 0); } 100% { box-shadow: 0 0 0 0 rgba(59, 71, 216, 0); } }

/* 「今天」：渐变大卡片 */
.hero { position: relative; overflow: hidden; border-radius: 22px; padding: 18px 18px 16px; color: #fff; background: var(--grad); box-shadow: 0 12px 30px rgba(29, 95, 209, .3); }
.hero::after { content: ""; position: absolute; right: -40px; top: -50px; width: 180px; height: 180px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .22), transparent 70%); pointer-events: none; }
.hero h1 { font-size: 1.4667rem; font-weight: 800; color: #fff; }
.hero .hero-line { margin-top: 2px; font-size: 0.9333rem; opacity: .92; }
.hero-stats { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.hero-stat { padding: 10px; border-radius: 14px; background: rgba(255, 255, 255, .15); border: 0; color: #fff; text-align: left; box-shadow: none; }
.hero-stat b { display: block; font-size: 1.2667rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.hero-stat span { font-size: 0.8rem; opacity: .88; }
button.hero-stat:hover { background: rgba(255, 255, 255, .22); }

/* 待办卡片：左边一条颜色表示急不急，左上角客户头像 */
.followup { background: var(--card); border: 0; border-left: 4px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.followup.lv-bad { border-left-color: #d03b3b; }
.followup.lv-warn { border-left-color: var(--warn-dot); }
.followup.lv-grey { border-left-color: var(--st1); }
.followup .title { font-size: 1.0667rem; font-weight: 700; }
.av { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 1rem; }
.av.sm { width: 32px; height: 32px; border-radius: 10px; font-size: 0.8667rem; }
.av.round { border-radius: 50%; }
.av.c0 { background: #2a78d6; } .av.c1 { background: #6250d6; } .av.c2 { background: #0e8f6a; } .av.c3 { background: #c2552b; } .av.c4 { background: #b4457a; } .av.c5 { background: #3a6b8a; }
.reason { border-left: 0; padding: 6px 10px; border-radius: 10px; background: var(--warn-soft); }
.reason.bad { background: var(--bad-soft); }
.reason.task { background: var(--primary-soft); }

/* 客户页：头部、阶段进度 */
.cu-title { display: flex; gap: 12px; align-items: center; }
.cu-title .av { width: 48px; height: 48px; border-radius: 14px; font-size: 1.3333rem; }
.cu-title h3 { font-size: 1.4667rem; line-height: 1.25; }
.deal-big { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.deal-big b { font-size: 1.7333rem; font-variant-numeric: tabular-nums; }
.stage-track { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 6px; }
.stage-track i { height: 6px; border-radius: 99px; background: #e3e9f1; }
.stage-track i.done { background: var(--st3); }
.stage-track i.now { background: var(--st5); }
.stage-names { display: grid; grid-template-columns: repeat(5, 1fr); font-size: 0.7333rem; color: var(--muted); text-align: center; }
.stage-names .now { color: var(--ink); font-weight: 700; }
.stage-lost { font-size: 0.8667rem; color: var(--bad); font-weight: 600; }
.seg { background: #e6ebf2; border-radius: 14px; padding: 4px; }
.seg button { border-radius: 10px; padding: 8px 0; }
.seg button[aria-selected="true"] { font-weight: 700; box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.pf-meter i { width: 1rem; height: 0.5333rem; border-radius: 99px; }
.pf-meter i.on.warn { background: var(--warn-dot); }
.pf-tag { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.feed .item { border-bottom: 0; position: relative; padding: 0 0 14px 22px; }
.feed .item::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: -2px; width: 2px; background: var(--line); }
.feed .item::after { content: ""; position: absolute; left: 0; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--meet); box-shadow: 0 0 0 3px var(--card); }
.feed .item:last-child::before { display: none; }
.feed .item[data-k="call"]::after { background: var(--call); }
.feed .item[data-k="message"]::after { background: var(--msg); }

/* ---------- 老板端 ---------- */
.console { padding-bottom: 28px; }
.kpis { gap: 10px; }
.kpi { border-radius: var(--radius); }
.kpi:first-child { color: #fff; background: var(--grad); box-shadow: 0 10px 24px rgba(29, 95, 209, .28); }
.kpi:first-child .label { color: rgba(255, 255, 255, .82); }
.kpi .value { font-weight: 800; font-variant-numeric: tabular-nums; }
.toptabs button .tab-ic { display: none; }
/* 销售管道：阶段由浅到深一种蓝 */
.hbar { border-radius: 0 6px 6px 0; height: 20px; }
.hbar-row[data-pick="stage:lead"] .hbar { background: var(--st1); }
.hbar-row[data-pick="stage:qualified"] .hbar { background: var(--st2); }
.hbar-row[data-pick="stage:proposal"] .hbar { background: var(--st3); }
.hbar-row[data-pick="stage:negotiation"] .hbar { background: var(--st4); }
.hbar-row[data-pick="stage:won"] .hbar { background: var(--st5); }
/* 今天团队：一人一行 */
.people { display: flex; flex-direction: column; }
.person { display: flex; gap: 12px; align-items: flex-start; padding: 12px 4px; border-top: 1px solid var(--line); cursor: pointer; border-radius: 12px; }
.person:first-child { border-top: 0; }
.person:hover { background: #f7f9fc; }
.person .main { flex: 1; min-width: 0; }
.person .nm { font-weight: 700; }
.kind-bar { display: flex; gap: 2px; height: 8px; margin: 6px 0 4px; max-width: 260px; }
.kind-bar i { display: block; height: 8px; border-radius: 2px; }
.kind-bar i:first-child { border-radius: 4px 2px 2px 4px; } .kind-bar i:last-child { border-radius: 2px 4px 4px 2px; } .kind-bar i:only-child { border-radius: 4px; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 0.8rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
/* 风险商机 */
.risk { display: flex; gap: 12px; }
.risk-ic { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-weight: 800; }
#risks .item { padding: 12px 0; border-top: 1px solid var(--line); }
#risks .item::before, #risks .item::after { display: none; }
#risks .item:first-child { border-top: 0; padding-top: 2px; }

/* 报表：卡片（手机）；表格（电脑） */
.rp-cards { display: none; }
.rp-sum { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rp-sum .card { padding: 12px 14px; }
.rp-sum .l { font-size: 0.8rem; color: var(--muted); }
.rp-sum .v { font-size: 1.4667rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.rp-sum .d { font-size: 0.8rem; }
.rep-card { cursor: pointer; }
.rep-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.rep-grid div { padding: 8px 4px; border-radius: 12px; background: #f5f7fb; text-align: center; }
.rep-grid b { display: block; font-size: 1.1333rem; font-variant-numeric: tabular-nums; }
.rep-grid span { font-size: 0.7333rem; color: var(--muted); }
.cmp .lab { display: flex; font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; }
.cmp .lab b { margin-left: auto; color: var(--ink); }
.cmp .tr { position: relative; height: 10px; border-radius: 99px; background: #eef1f6; }
.cmp .fill { height: 10px; border-radius: 99px; background: var(--meet); }
.cmp .avg { position: absolute; top: -4px; width: 2px; height: 18px; background: var(--ink); border-radius: 2px; }
.acc-row { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; }
.acc-row:first-child { border-top: 0; padding-top: 0; }
.acc-row .main { flex: 1; min-width: 0; }
.up-text { color: var(--ok); }
.down-text { color: var(--bad); }

/* ---------- 手机上 ---------- */
@media (max-width: 640px) {
  .phone main { padding: 8px 14px 14px; }
  /* 老板端：页签挪到底部，带图标；顶栏只留公司名、铃铛、名字 */
  body.console-page { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  /* 毛玻璃（backdrop-filter）会让里面 position: fixed 的页签跟着顶栏走，到不了屏幕底部：手机上老板端顶栏不用毛玻璃 */
  .console-page .topbar { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(243, 245, 249, .97); }
  .toptabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; order: 0; width: auto; margin: 0; display: flex; gap: 0; overflow: visible; padding: 4px 4px calc(6px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .95); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
  .toptabs button { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 4px; font-size: 0.7333rem; background: transparent !important; color: var(--muted); }
  .toptabs button.active { color: var(--primary); background: transparent; }
  .toptabs button .tab-ic { display: block; width: 24px; height: 24px; }
  .toptabs button .tab-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .fab { bottom: calc(84px + env(safe-area-inset-bottom)); }
  /* 数字卡片横着滑 */
  .kpis { display: flex; overflow-x: auto; margin: 0 -10px; padding: 2px 10px 8px; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .kpis::-webkit-scrollbar { display: none; }
  .kpis .kpi { flex: none; width: 46vw; max-width: 180px; scroll-snap-align: start; }
  /* 报表：手机上用卡片，不用表格 */
  .rp-table { display: none; }
  .rp-cards { display: block; }
  .rp-controls { display: flex; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; margin: 0 -14px; padding: 0 14px; }
  .rp-controls::-webkit-scrollbar { display: none; }
  .rp-controls .spacer { display: none; }
}
@media (prefers-reduced-motion: reduce) { .tabbar .mic-icon::after { animation: none; } }
