/* =========================================================================
 * styles.css — 玺丽璞悦CRM 静态原型样式
 * 浅色主题 · 现代 SaaS 风格 · 暖橙/砖红品牌色 · 中文界面
 * ========================================================================= */

/* 角色权限矩阵 - 可点击单元格与数据范围选择 */
.perm-cell { cursor: pointer; transition: background .15s; }
.perm-cell:hover { background: rgba(184,92,56,.10); }
.chip-on { background: var(--brand); color: #fff; border-color: var(--brand); }
.row-actions { white-space: nowrap; }
.row-actions .btn { margin-right: 4px; }

:root {
  --brand: #b85c38;        /* 砖红主色 */
  --brand-2: #d98b5f;      /* 暖橙 */
  --brand-soft: #f6e7dd;   /* 主色浅底 */
  --ink: #2d2a26;          /* 主文字 */
  --ink-2: #5f5a54;        /* 次文字 */
  --muted: #8a817c;        /* 弱文字 */
  --line: #ece7e1;         /* 分隔线 */
  --bg: #f7f5f2;           /* 页面背景（暖白） */
  --surface: #ffffff;      /* 卡片/表面 */
  --surface-2: #fbf9f6;    /* 次级表面 */
  --ok: #3f7d6e;           /* 健康/成功 */
  --warn: #d98b3a;         /* 提醒 */
  --danger: #c8553d;       /* 预警 */
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(45,42,38,.04), 0 8px 24px rgba(45,42,38,.06);
  --shadow-sm: 0 1px 2px rgba(45,42,38,.06);
  --sidebar-w: 216px;
  --right-w: 330px;
  --top-h: 58px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #d9d3cc; border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 总体布局 ---------- */
#app { min-height: 100vh; }
.layout { display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  height: var(--top-h); background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px; padding: 0 18px; position: sticky; top: 0; z-index: 30;
}
.body-row { display: flex; flex: 1; min-height: 0; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); background: var(--surface);
  border-right: 1px solid var(--line); padding: 14px 10px; position: sticky; top: var(--top-h);
  align-self: flex-start; height: calc(100vh - var(--top-h)); overflow-y: auto;
}
.main-area { flex: 1; display: flex; min-width: 0; }
.main { flex: 1; padding: 22px 26px; overflow-y: auto; min-width: 0; }
.right-panel {
  width: var(--right-w); flex: 0 0 var(--right-w); background: var(--surface);
  border-left: 1px solid var(--line); padding: 16px 16px 26px; overflow-y: auto;
  height: calc(100vh - var(--top-h)); position: sticky; top: var(--top-h);
}
.right-collapsed .right-panel { display: none; }
.right-collapsed .main { padding-right: 40px; }

/* ---------- 顶部栏 ---------- */
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--brand); }
.logo .mark {
  width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 800;
}
.global-search {
  flex: 1; max-width: 460px; position: relative;
}
.global-search input {
  width: 100%; height: 38px; border: 1px solid var(--line); background: var(--surface-2);
  border-radius: 20px; padding: 0 16px 0 38px; font-size: 13px; color: var(--ink); outline: none;
}
.global-search input:focus { border-color: var(--brand-2); background: #fff; }
.global-search .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); font-size: 17px; position: relative;
}
.icon-btn:hover { background: var(--brand-soft); border-color: var(--brand-2); }
.icon-btn .dot { position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); }
.agent-entry {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 20px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border: none; font-weight: 600; font-size: 13px;
}
.agent-entry:hover { filter: brightness(1.05); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: #fff; display: flex;
  align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}

/* ---------- 侧边栏 ---------- */
.nav-group-title { font-size: 11px; color: var(--muted); letter-spacing: .08em; margin: 14px 10px 6px; font-weight: 700; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: var(--ink-2);
  font-size: 13.5px; margin-bottom: 2px; border: 1px solid transparent; user-select: none;
}
.nav-item .ni-ico { width: 20px; text-align: center; font-size: 15px; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; border-color: #f0d8c9; }
.nav-item .badge { margin-left: auto; }

/* ---------- 通用卡片/标题 ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 18px;
}
.card-pad-lg { padding: 22px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: 20px; font-weight: 700; margin: 0; }
.page-sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.section-title { font-size: 15px; font-weight: 700; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.muted { color: var(--muted); }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 15px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 600;
}
.btn:hover { border-color: var(--brand-2); color: var(--brand); }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border: none;
}
.btn-primary:hover { filter: brightness(1.05); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--brand); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 12px; border-radius: 8px; }
.btn-xs { height: 24px; padding: 0 9px; font-size: 11.5px; border-radius: 7px; font-weight: 600; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* 列表项内的行内操作（修改 / 删除） */
.row-actions { display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap; }

/* ---------- 徽章/标签 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 20px;
  font-size: 12px; font-weight: 600; line-height: 1.6;
}
.badge-brand { background: var(--brand-soft); color: var(--brand); }
.badge-ok { background: #e3f0eb; color: var(--ok); }
.badge-warn { background: #fbeed9; color: var(--warn); }
.badge-danger { background: #f7e0da; color: var(--danger); }
.badge-muted { background: #eeeae5; color: var(--muted); }
.badge-c { background: #e7eef5; color: #5b7fa6; }
.badge-b { background: #f6e6d4; color: #b9772f; }
.badge-a { background: #f4ddd0; color: #b85c38; }
.chip {
  display: inline-block; padding: 2px 9px; border-radius: 7px; background: var(--surface-2);
  border: 1px solid var(--line); color: var(--ink-2); font-size: 12px; margin: 2px 4px 2px 0;
}

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 10px 12px;
  border-bottom: 1px solid var(--line); background: var(--surface-2); position: sticky; top: 0;
}
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: none; }
.avatar-sm {
  width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; margin-right: 9px;
}
.cell-name { display: flex; align-items: center; }
.health-bar { width: 64px; height: 7px; border-radius: 5px; background: #eeeae5; overflow: hidden; display: inline-block; vertical-align: middle; }
.health-bar > i { display: block; height: 100%; border-radius: 5px; }

/* ---------- 过滤器 ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.select, .input {
  height: 36px; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px; background: var(--surface);
  font-size: 13px; color: var(--ink); outline: none;
}
.select:focus, .input:focus { border-color: var(--brand-2); }
.input.search { min-width: 220px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  padding: 9px 14px; font-size: 13.5px; color: var(--ink-2); border: none; background: none; border-bottom: 2px solid transparent;
  margin-bottom: -1px; font-weight: 600;
}
.tab:hover { color: var(--brand); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ---------- 客户详情头部 ---------- */
.profile-head { display: flex; gap: 18px; align-items: center; }
.profile-avatar {
  width: 64px; height: 64px; border-radius: 18px; background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 24px; flex: 0 0 auto;
}
.kv { display: grid; grid-template-columns: 88px 1fr; gap: 4px 10px; font-size: 13px; }
.kv .k { color: var(--muted); }
.kv .v { color: var(--ink); }
.health-score {
  width: 70px; height: 70px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 800; font-size: 20px; color: #fff; flex: 0 0 auto;
}
.health-score span { font-size: 10px; font-weight: 600; opacity: .9; }

/* ---------- 右侧智能体面板 ---------- */
.agent-card { border: 1px solid #f0d8c9; background: linear-gradient(180deg, #fffaf6, #fff); border-radius: var(--radius); overflow: hidden; }
.agent-card-head {
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; padding: 13px 15px;
  display: flex; align-items: center; gap: 9px;
}
.agent-card-head .ab { font-size: 18px; }
.agent-card-head .t { font-weight: 700; font-size: 14px; }
.agent-card-head .s { font-size: 11px; opacity: .9; }
.agent-section { padding: 13px 15px; border-bottom: 1px dashed var(--line); }
.agent-section:last-child { border-bottom: none; }
.agent-section h4 { margin: 0 0 8px; font-size: 13px; color: var(--brand); display: flex; align-items: center; gap: 6px; }
.agent-bullet { display: flex; gap: 8px; padding: 6px 0; font-size: 12.5px; color: var(--ink-2); align-items: flex-start; }
.agent-bullet .b { color: var(--brand); flex: 0 0 auto; }
.script-box {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 11px; font-size: 12.5px;
  color: var(--ink); line-height: 1.7;
}
.gauge { display: flex; align-items: center; gap: 10px; }
.gauge .ring { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 14px; }

/* ---------- KPI 卡 ---------- */
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.kpi .label { color: var(--muted); font-size: 12.5px; }
.kpi .value { font-size: 26px; font-weight: 800; margin-top: 6px; color: var(--ink); }
.kpi .value small { font-size: 13px; font-weight: 600; color: var(--muted); }
.kpi .ico { position: absolute; right: 14px; top: 14px; font-size: 22px; opacity: .85; }

/* ---------- 图表 ---------- */
.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.chart-title { font-size: 13.5px; font-weight: 700; margin-bottom: 12px; }
.pie-wrap { display: flex; align-items: center; gap: 16px; }
.pie {
  width: 130px; height: 130px; border-radius: 50%; flex: 0 0 auto; position: relative;
}
.pie::after { content: ''; position: absolute; inset: 30px; background: var(--surface); border-radius: 50%; }
.pie-legend { font-size: 12.5px; }
.pie-legend .li { display: flex; align-items: center; gap: 7px; padding: 3px 0; }
.pie-legend .sw { width: 11px; height: 11px; border-radius: 3px; }
.bar-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 12.5px; }
.bar-row .name { width: 72px; color: var(--ink-2); flex: 0 0 auto; }
.bar-track { flex: 1; height: 16px; background: var(--surface-2); border-radius: 8px; overflow: hidden; position: relative; }
.bar-fill { height: 100%; border-radius: 8px; }
.bar-val { width: 46px; text-align: right; color: var(--muted); flex: 0 0 auto; }
.trend-svg { width: 100%; height: 160px; }

/* ---------- 日历 ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0; font-weight: 600; }
.cal-cell {
  min-height: 74px; border: 1px solid var(--line); border-radius: 10px; padding: 6px; background: var(--surface); font-size: 12px;
}
.cal-cell.out { background: var(--surface-2); color: var(--muted); }
.cal-cell .dnum { font-weight: 700; color: var(--ink-2); }
.cal-cell.today { border-color: var(--brand-2); box-shadow: 0 0 0 2px var(--brand-soft) inset; }
.cal-ev { font-size: 10.5px; padding: 1px 5px; border-radius: 6px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 预警卡 ---------- */
.alert-item { display: flex; gap: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); margin-bottom: 10px; }
.alert-item.danger { border-color: #f3cfc6; background: #fdf4f1; }
.alert-item.warn { border-color: #f3e2c4; background: #fdf8ef; }
.alert-ico { font-size: 18px; flex: 0 0 auto; }
.alert-body { font-size: 12.5px; }
.alert-body .nm { font-weight: 700; color: var(--ink); }

/* ---------- 模态框 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(45,42,38,.42); display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal {
  background: var(--surface); border-radius: 16px; width: min(640px, 92vw); max-height: 88vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.x-btn { border: none; background: none; font-size: 20px; color: var(--muted); }

/* 表单 */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 5px; font-weight: 600; }
.form-row label .req { color: var(--danger); }
.form-row input, .form-row textarea, .form-row select {
  width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; font-size: 13px; font-family: inherit; color: var(--ink); outline: none;
}
.form-row textarea { resize: vertical; min-height: 70px; }
.form-row input:focus, .form-row textarea:focus, .form-row select:focus { border-color: var(--brand-2); }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { width: auto; }

/* ---------- 智能体对话页 ---------- */
/* 对话区高度锁定视口，内部滚动，输入栏常驻底部 */
.chat-wrap { display: flex; gap: 16px; align-items: stretch; height: calc(100vh - var(--top-h) - 200px); min-height: 420px; }
.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-box { flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; overflow-y: auto; min-height: 0; }
.chat-input-bar { display: flex; gap: 10px; margin-top: 12px; flex: 0 0 auto; }
.chat-input-bar input { flex: 1; }
.quick-actions { width: 220px; flex: 0 0 auto; overflow-y: auto; min-height: 0; }
.msg { display: flex; gap: 10px; margin-bottom: 14px; }
.msg .m-av { width: 32px; height: 32px; border-radius: 9px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; font-size: 15px; }
.msg.user .m-av { background: var(--brand); color: #fff; }
.msg.bot .m-av { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
.msg .m-body { background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; padding: 10px 13px; font-size: 13px; max-width: 76%; white-space: pre-wrap; line-height: 1.7; }
.msg.user { flex-direction: row-reverse; }
.msg.user .m-body { background: var(--brand-soft); border-color: #f0d8c9; }
.quick-actions { width: 220px; flex: 0 0 auto; }
.quick-actions .qa {
  display: block; width: 100%; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); margin-bottom: 8px; font-size: 13px; color: var(--ink-2);
}
.quick-actions .qa:hover { border-color: var(--brand-2); color: var(--brand); background: var(--brand-soft); }
.scheme-lib-item { border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; margin-bottom: 9px; background: var(--surface); cursor: pointer; transition: border-color .15s; }
.scheme-lib-item:hover { border-color: var(--brand-2); }
.scheme-lib-item .st { font-weight: 700; font-size: 13px; }
.scheme-lib-item .sm { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ---------- 右侧智能体面板对话 ---------- */
.rchat-box { max-height: 280px; overflow-y: auto; padding: 4px 2px 6px; }
.rchat-box .msg { margin-bottom: 10px; gap: 8px; }
.rchat-box .msg .m-av { width: 28px; height: 28px; font-size: 13px; border-radius: 8px; }
.rchat-box .msg .m-body { font-size: 12.5px; padding: 8px 11px; max-width: 82%; }
.rchat-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.qa-sm { border: 1px solid var(--line); border-radius: 20px; padding: 5px 10px; font-size: 11.5px; color: var(--ink-2); background: var(--surface); line-height: 1.3; }
.qa-sm:hover { border-color: var(--brand-2); color: var(--brand); background: var(--brand-soft); }

/* ---------- 时间轴 ---------- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding: 0 0 16px; }
.tl-item::before { content: ''; position: absolute; left: -19px; top: 4px; width: 11px; height: 11px; border-radius: 50%; background: var(--brand); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--brand-soft); }
.tl-date { font-size: 11.5px; color: var(--muted); }
.tl-title { font-weight: 600; font-size: 13px; margin: 2px 0; }
.tl-kind { display: inline-block; color: var(--brand); font-weight: 700; }
.tl-desc { font-size: 12.5px; color: var(--ink-2); }

/* ---------- 家庭成员 ---------- */
.fam-list { display: flex; flex-wrap: wrap; gap: 10px; }
.fam-card { border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; background: var(--surface-2); min-width: 150px; }
.fam-card .fn { font-weight: 700; font-size: 13px; }
.fam-card .fr { color: var(--brand); font-size: 12px; }

/* ---------- 提示条/空态 ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: 22px; font-size: 13px; z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.empty { text-align: center; color: var(--muted); padding: 30px; font-size: 13px; }
.note { font-size: 12px; color: var(--muted); margin-top: 6px; }
.note-box { padding: 10px 12px; background: var(--brand-soft); border: 1px solid var(--line); border-radius: 10px; font-size: 13px; line-height: 1.7; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  /* 窄屏：右侧智能体改为抽屉，点顶栏 🧩 开合 */
  .right-panel {
    position: fixed; right: 0; top: var(--top-h); bottom: 0; height: auto;
    width: min(360px, 92vw); transform: translateX(105%); transition: transform .25s ease;
    z-index: 45; box-shadow: -10px 0 28px rgba(45,42,38,.16);
  }
  .right-collapsed .right-panel { display: block; transform: translateX(105%); }
  #app:not(.right-collapsed) .right-panel { transform: none; }
}

/* ---------- 账号与组织 / 市调进度 ---------- */
.org-line { padding: 8px 4px; font-size: 13px; display: flex; align-items: center; gap: 6px; border-bottom: 1px dashed var(--line); }
.org-line:last-child { border-bottom: none; }
.org-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.org-dot.g { background: #8a6d3b; }
.org-dot.p { background: var(--brand); }
.org-dot.a { background: var(--ok); }
.org-dot.h { background: #c77dab; }

.perm { font-size: 12px; font-weight: 600; white-space: nowrap; }
.perm.full { color: var(--ok); }
.perm.edit { color: var(--brand); }
.perm.read { color: var(--ink-2); }
.perm.none { color: var(--muted); }

/* 市调进度样式随「市调潜客」模块下线已移除 */
.progress { width: 100%; height: 9px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.progress .bar { height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: 6px; }

/* 角色视图徽标 */
.role-badge { font-size: 11.5px; padding: 3px 10px; border-radius: 20px; font-weight: 700; white-space: nowrap; }
.role-badge.admin { background: #fbe9dd; color: var(--brand); }
.role-badge.staff { background: #e8eef3; color: #4a6b86; }

/* 登录界面 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #f6efe7, #ece2d6); padding: 24px; }
.login-card { width: min(430px, 94vw); background: var(--surface); border-radius: 18px; box-shadow: 0 24px 60px rgba(120,90,60,.18); padding: 30px 28px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-brand .mark { width: 46px; height: 46px; border-radius: 12px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 800; }
.lb-t { font-size: 19px; font-weight: 800; color: var(--ink); }
.lb-s { font-size: 12.5px; color: var(--muted); }
.login-form label { display: block; font-size: 12.5px; color: var(--ink-2); margin: 12px 0 5px; font-weight: 600; }
.login-form .input { width: 100%; }
.btn-block { width: 100%; margin-top: 16px; }
.login-hint { font-size: 11.5px; color: var(--muted); margin-top: 10px; line-height: 1.6; }
.login-demo { margin-top: 22px; border-top: 1px dashed var(--line); padding-top: 16px; }
.ld-title { font-size: 12.5px; color: var(--ink-2); margin-bottom: 10px; font-weight: 600; line-height: 1.6; }
.ld-group { font-size: 11.5px; color: var(--muted); margin: 10px 0 7px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.login-chip { display: flex; flex-direction: column; align-items: flex-start; border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; padding: 7px 11px; cursor: pointer; text-align: left; }
.login-chip:hover { border-color: var(--brand-2); background: var(--brand-soft); }
.login-chip b { font-size: 13px; color: var(--ink); }
.login-chip span { font-size: 11px; color: var(--muted); }

/* 客户分配漏斗（按归属人） */
.funnel-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.funnel-label { width: 76px; flex: 0 0 76px; font-size: 13px; color: var(--muted); text-align: right; }
.funnel-bar { height: 30px; min-width: 64px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: 6px; display: flex; align-items: center; justify-content: flex-end; padding-right: 10px; color: #fff; font-size: 12.5px; box-shadow: 0 1px 4px rgba(184,92,56,.18); }
.funnel-val { white-space: nowrap; }

/* 沟通中心筛选 / 渠道分布 */
.chip-btn { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 20px; padding: 3px 13px; font-size: 12.5px; cursor: pointer; margin-right: 6px; transition: all .15s; }
.chip-btn:hover { border-color: var(--brand-2); color: var(--brand); }
.chip-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.mini-title { font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }

/* 日历自定义活动删除 */
.cal-ev { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.cal-ev-x { cursor: pointer; font-weight: 700; opacity: .55; padding: 0 2px; line-height: 1; }
.cal-ev-x:hover { opacity: 1; }

/* 客户列表行内操作列 */
.row-action { text-align: right; white-space: nowrap; }

/* ---------- 消息中心（顶栏 🔔 下拉） ---------- */
.msg-count {
  position: absolute; top: 2px; right: 0; min-width: 15px; height: 15px; padding: 0 3px;
  border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}
.msg-pop {
  position: fixed; top: calc(var(--top-h) + 6px); right: 210px; width: min(380px, 92vw); z-index: 60;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 16px 44px rgba(45,42,38,.18); overflow: hidden;
}
.msg-pop-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); font-size: 14px;
}
.msg-pop-body { max-height: 420px; overflow-y: auto; padding: 8px; }
.msg-item {
  display: flex; gap: 9px; align-items: flex-start; padding: 9px 10px; border-radius: 10px;
  font-size: 12.5px; color: var(--ink-2); cursor: pointer; line-height: 1.6;
}
.msg-item:hover { background: var(--brand-soft); color: var(--ink); }
.msg-item .mi-ico { flex: 0 0 auto; font-size: 14px; }

/* ---------- 客户表单 AI 评定预览 ---------- */
.assess-box {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; display: flex; flex-direction: column; gap: 8px;
}
.assess-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.assess-k { color: var(--muted); font-size: 12.5px; width: 52px; flex: 0 0 auto; }

/* ---------- 客户价值徽章（AI 五维模型） ---------- */
.value-badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.value-s { background: #f4ddd0; color: #a34d1f; }
.value-a { background: #fbeed9; color: #b9772f; }
.value-b { background: #e7eef5; color: #4a6b86; }
.value-c { background: #eeeae5; color: #8a817c; }

/* ---------- 标签选择器（客户表单） ---------- */
.tag-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip {
  display: inline-block; padding: 4px 12px; border-radius: 20px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2); font-size: 12.5px; cursor: pointer; user-select: none;
  transition: all .15s;
}
.tag-chip:hover { border-color: var(--brand-2); color: var(--brand); }
.tag-chip.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }

/* ---------- 表单两列网格 ---------- */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

/* ---------- 家庭成员元信息 ---------- */
.fam-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 5px; font-size: 12px; color: var(--ink-2); }

/* ---------- 日历图例 / 事件 ---------- */
.cal-legend { margin: 0; }
.cal-legend.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.cal-ev { cursor: pointer; }
.cal-ev:hover { filter: brightness(.96); }
.cal-ev.dim { opacity: .28; filter: grayscale(.6); }
.cal-cell { cursor: pointer; }
.cal-cell:hover { border-color: var(--brand-2); }

/* ---------- 移动端响应式（窄屏适配） ---------- */
@media (max-width: 900px) {
  .body-row { flex-direction: column; }
  .sidebar {
    width: 100%; flex: 0 0 auto; height: auto; position: sticky; top: var(--top-h);
    display: flex; gap: 6px; align-items: center; overflow-x: auto; padding: 8px 10px;
    border-right: none; border-bottom: 1px solid var(--line); white-space: nowrap;
  }
  .sidebar .nav-group-title { display: none; }
  .nav-item { margin-bottom: 0; flex: 0 0 auto; }
  .main-area { flex-direction: column; }
  .right-panel { width: 100%; flex: 0 0 auto; height: auto; position: static; border-left: none; border-top: 1px solid var(--line); transform: none; box-shadow: none; }
  .right-collapsed .right-panel { display: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; gap: 8px; height: auto; padding: 8px 12px; }
  .global-search { order: 3; flex-basis: 100%; max-width: none; }
  .main { padding: 14px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .profile-head { flex-wrap: wrap; }
}
@media (max-width: 560px) {
  .top-actions .agent-entry { display: none; }
  .table th, .table td { padding: 8px; font-size: 12px; }
  .table .row-action .btn { padding: 0 8px; }
  .kpi .value { font-size: 22px; }
  .chat-wrap { flex-direction: column; height: auto; min-height: 0; }
  .chat-box { max-height: 55vh; }
  .quick-actions { width: 100%; flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 8px; overflow: visible; }
  .quick-actions .qa { width: auto; margin-bottom: 0; }
  .form-grid-2 { grid-template-columns: 1fr; }
}

/* ---------- 智能晨报卡片（工作台 / 智能体页） ---------- */
.brief-card { border-left: 3px solid var(--brand); }
.brief-item { display: flex; gap: 10px; align-items: flex-start; padding: 9px 6px; border-bottom: 1px dashed var(--line); cursor: pointer; }
.brief-item:last-child { border-bottom: none; }
.brief-item:hover { background: var(--surface-2); }
.brief-item.brief-done { opacity: .62; }
.brief-item.brief-done:hover { background: transparent; }
.brief-scroll { max-height: 264px; overflow-y: auto; padding-right: 4px; }
.bi-ico { font-size: 18px; flex: 0 0 auto; line-height: 1.4; }
.bi-body { flex: 1; min-width: 0; }
.bi-t { font-size: 13px; font-weight: 600; color: var(--ink); }
.bi-s { font-size: 12px; }

/* ---------- 版本页脚（登录页 / 主界面） ---------- */
.login-foot { margin-top: 18px; padding-top: 12px; border-top: 1px dashed var(--line); text-align: center; font-size: 12px; color: var(--muted); }
.app-foot { padding: 10px 18px; text-align: center; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); background: var(--surface); }
