:root {
  --bg: #f3f5f9;
  --sidebar: #f7f8fb;
  --panel: #ffffff;
  --line: #e8ebf0;
  --text: #1f2937;
  --muted: #8b95a5;
  --blue: #3b82f6;
  --blue-soft: #eff6ff;
  --blue-dark: #2563eb;
  --green: #10b981;
  --green-soft: #ecfdf5;
  --purple-soft: #f3e8ff;
  --yellow-soft: #fffbeb;
  --cyan-soft: #ecfeff;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --warn: #f59e0b;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px rgba(16, 24, 40, 0.04);
  --radius: 14px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "Cascadia Code", "Consolas", monospace;
  --sidebar-w: 220px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
}
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-dark); }

.app-body { overflow: hidden; }
.app {
  display: flex;
  height: 100%;
  width: 100%;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  z-index: 40;
}
.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 18px;
}
.side-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(145deg, #60a5fa, #2563eb);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 16px;
}
.side-brand strong {
  display: block;
  font-size: 14px;
  line-height: 1.2;
}
.side-brand em {
  display: block;
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow: auto;
}
.side-nav a,
.side-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #4b5563;
  text-decoration: none;
  font-size: 14px;
  transition: background .15s, color .15s;
}
.side-nav a:hover,
.side-logout:hover {
  background: #eef2f7;
  color: var(--text);
}
.side-nav a.active {
  background: var(--blue);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.28);
}
.side-nav .ico,
.side-logout .ico {
  width: 18px;
  height: 18px;
  display: inline-flex;
}
.side-nav .ico svg,
.side-logout .ico svg {
  width: 18px;
  height: 18px;
}
.side-logout {
  margin-top: 8px;
  color: #9ca3af;
  border: 0;
  background: transparent;
  cursor: pointer;
  width: 100%;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg);
}
.topbar {
  height: 64px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  background: rgba(255,255,255,0.86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.top-title {
  font-size: 16px;
  font-weight: 600;
}
.top-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
}
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(145deg, #93c5fd, #3b82f6);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
}
.uname { font-size: 13px; color: #374151; }

.wecom-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.wecom-login-tip {
  margin-bottom: 14px;
}

.menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.menu-btn span {
  width: 14px;
  height: 2px;
  background: #64748b;
  border-radius: 2px;
}

.content-scroll {
  flex: 1;
  overflow: auto;
}
.content {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 16px 18px 28px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.page-head h1 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.page-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.panel h2 {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.panel-head h2 { margin: 0; }
.panel > label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #6b7280;
}
.panel > label input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.panel > label textarea {
  width: 100%;
  background: #fff;
  border: 1px solid #dbe1ea;
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}
.stats-3 {
  grid-template-columns: repeat(3, 1fr);
}
.stats-4 {
  grid-template-columns: repeat(4, 1fr);
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  position: relative;
  overflow: hidden;
}
.stat-ico {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
}
.stat-ico svg { width: 18px; height: 18px; }
.stat-ico.blue { background: var(--blue-soft); color: var(--blue); }
.stat-ico.green { background: var(--green-soft); color: var(--green); }
.stat-ico.purple { background: var(--purple-soft); color: #9333ea; }
.stat-ico.yellow { background: var(--yellow-soft); color: #d97706; }
.stat em {
  display: block;
  font-style: normal;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}
.stat span {
  display: block;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #111827;
}
.stat small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}
.ov-ranks {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.ov-ranks.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.ov-ranks .panel {
  margin-bottom: 0;
}
.ov-ranks .panel-head {
  padding: 10px 12px 8px;
}
.ov-ranks .panel-head h2 {
  font-size: 13px;
}
.ov-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 12px;
}
.ov-ranges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.ov-ranges button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.ov-ranges button.on {
  background: #eef4ff;
  border-color: #bfdbfe;
  color: var(--blue-dark);
  font-weight: 650;
}
.ov-range-note {
  color: var(--muted);
  font-size: 12px;
}
.ov-rank-body { min-height: 120px; }
.ov-rank-list {
  list-style: none;
  margin: 0;
  padding: 0 8px 8px;
}
.ov-rank-list li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 4px;
  font-size: 12px;
}
.ov-rank-list em {
  width: 16px;
  color: var(--muted);
  font-style: normal;
  text-align: right;
  flex-shrink: 0;
}
.ov-rank-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ov-rank-list strong {
  flex-shrink: 0;
  font-weight: 650;
  color: #334155;
  font-size: 11px;
}
.ov-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #e8eaed;
}
.ov-avatar-fallback {
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  background: linear-gradient(145deg, #60a5fa, #2563eb);
}
.ov-empty, .ov-skel {
  padding: 18px 12px;
  color: var(--muted);
  font-size: 12px;
}
.ov-loading .ov-rank-body { opacity: .55; }
.ov-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.ov-charts .panel { margin-bottom: 0; }
.ov-chart {
  height: 180px;
  padding: 4px 8px 8px;
}
.ov-chart svg {
  width: 100%;
  height: 100%;
  display: block;
}
.ov-chart-line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.ov-chart-fill { fill-opacity: .12; }
.ov-chart-grid {
  fill: none;
  stroke: #e5e7eb;
  stroke-width: 1;
}
.ov-chart text {
  fill: #94a3b8;
  font-size: 10px;
}
.ov-chart-max { font-size: 10px; }

.form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #6b7280;
}
.form {
  width: 100%;
}
.form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.form select,
.form textarea {
  width: 100%;
  background: #fff;
  border: 1px solid #dbe1ea;
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):focus,
.form select:focus,
.form textarea:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
.grid2 .full { grid-column: 1 / -1; }
.check {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
}
.scope-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  color: #6b7280;
}
.scope-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 8px;
}
.scope-options label {
  flex-direction: row !important;
  align-items: center;
  gap: 6px !important;
  margin: 0 !important;
  color: var(--text);
}
.scope-users { margin-top: 8px; }
.scope-users input[type="search"] { margin-bottom: 8px; }
.member-pick {
  max-height: 280px;
  overflow: auto;
  border: 1px solid #dbe1ea;
  border-radius: 10px;
  background: #fff;
  padding: 6px 8px;
}
.member-pick label {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
  margin: 0 !important;
  padding: 6px 4px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
}
.member-pick label:last-child { border-bottom: 0; }
.member-pick em, .member-pick code {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}
.member-pick code { margin-left: auto; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.hint, .muted { color: var(--muted); font-size: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--blue);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}
.btn:hover { background: var(--blue-dark); color: #fff; text-decoration: none; }
.btn-sm {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 4px;
}
.btn-ghost {
  background: #fff;
  color: var(--blue);
  border: 1px solid #bfdbfe;
  box-shadow: none;
}
.btn-ghost:hover { background: var(--blue-soft); color: var(--blue-dark); }
.danger {
  background: transparent;
  border: 0;
  color: var(--danger);
  cursor: pointer;
  padding: 0;
  font: inherit;
}
.linkish {
  background: none;
  border: 0;
  color: var(--blue);
  cursor: pointer;
  padding: 0;
  font: inherit;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th, .table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.table th {
  color: var(--muted);
  font-weight: 500;
  background: #fafbfc;
}
.table tr:last-child td { border-bottom: 0; }
.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-bottom: 12px;
}
.filter-row .search {
  flex: 1 1 280px;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.filter-row .search input,
.filter-row .search select {
  width: 100%;
  background: #fff;
  border: 1px solid #dbe1ea;
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
}
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.chip {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid #dbe1ea;
  background: #fff;
  color: #4b5563;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
}
.chip:hover { border-color: #93c5fd; color: var(--blue); }
.chip.on {
  background: var(--blue-soft);
  border-color: #93c5fd;
  color: var(--blue-dark);
  font-weight: 650;
}
.chip-input { display: none; }
.flow-stages {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 8px 0 4px;
}
.flow-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fbfcfe;
}
.flow-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.flow-card p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.chip-input + .chip { margin: 0; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.4);
}
.modal.open { display: flex; }
.modal-card {
  width: min(720px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
  padding: 18px 20px 16px;
}
.modal-card h2 { margin: 0 0 14px; font-size: 16px; }
.mono { font-family: var(--mono); word-break: break-all; }
.ops { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.inline { display: inline; margin: 0; }
.inline-form { margin-bottom: 12px; }
.sync-form { margin-top: 8px; }

.field-block,
.paste-field {
  display: block;
  width: 100%;
  margin-bottom: 14px;
}
.field-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #6b7280;
}
.block-hint {
  margin: 0 0 16px;
  line-height: 1.5;
}
.form-subtitle {
  margin: 20px 0 12px;
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}
.field-note {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
.ok-note { color: #059669; }
.err-note { color: #dc2626; }
.wecom-status-list {
  margin: 0 0 14px;
  padding: 12px 14px;
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.8;
  list-style: none;
}
.wecom-status-list code {
  font-family: var(--mono);
  font-size: 12px;
}

.quick-paste-panel {
  background: linear-gradient(180deg, #ffffff 0%, #fafbff 100%);
}
.quick-paste-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}
.paste-field {
  margin: 0;
}
.paste-label {
  display: block;
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 8px;
}
.quick-paste-panel .quick-paste {
  display: block;
  width: 100%;
  min-height: 180px;
  max-height: 360px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  padding: 14px 16px;
  border: 1px solid #dbe1ea;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
}
.quick-paste-panel .quick-paste:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}
.quick-preview {
  margin: 0;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  font-size: 13px;
  line-height: 1.6;
  min-height: 52px;
}
.quick-preview.is-empty {
  color: var(--muted);
  text-align: center;
}
.quick-preview.ok {
  border-color: #a7f3d0;
  background: var(--green-soft);
  color: #065f46;
  text-align: left;
}
.quick-preview.err {
  border-color: #fecaca;
  background: var(--danger-soft);
  color: #991b1b;
  text-align: left;
}
.quick-preview dl {
  margin: 0;
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 8px 12px;
}
.quick-preview dt { color: #6b7280; margin: 0; font-weight: 500; }
.quick-preview dd { margin: 0; word-break: break-all; }
.quick-paste-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding-top: 2px;
}
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #f3f4f6;
  color: #6b7280;
}
.tag-ok { background: var(--green-soft); color: #059669; }
.tag-fail { background: var(--danger-soft); color: #dc2626; }
.tag-unknown { background: var(--yellow-soft); color: #d97706; }

.toast {
  margin-bottom: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  border: 1px solid transparent;
}
.toast-ok { background: var(--green-soft); color: #047857; border-color: #a7f3d0; }
.toast-err { background: var(--danger-soft); color: #b91c1c; border-color: #fecaca; }

.auth-wrap {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  background:
    radial-gradient(700px 320px at 15% 10%, rgba(59,130,246,0.12), transparent 60%),
    radial-gradient(600px 280px at 90% 0%, rgba(16,185,129,0.08), transparent 55%),
    var(--bg);
}
.auth-box {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.auth-box h1 {
  margin: 0 0 18px;
  font-size: 22px;
}
.ok { color: var(--green); }

.front .hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  background:
    radial-gradient(800px 360px at 50% 0%, rgba(59,130,246,0.16), transparent 60%),
    var(--bg);
}
.hero-inner {
  width: min(720px, 100%);
  text-align: left;
}
.logo {
  margin: 0 0 18px;
  font-size: clamp(36px, 7vw, 56px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  color: #111827;
}
.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(18px, 2.4vw, 24px);
  font-weight: 500;
  color: #4b5563;
}
.lead {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 15px;
}
.cta { display: flex; gap: 12px; }

.front-list {
  max-width: 720px;
  margin: -40px auto 60px;
  padding: 0 20px;
}
.front-list h2 {
  font-size: 15px;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 12px;
}
.front-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.front-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.front-list li:last-child { border-bottom: 0; }
.front-list em {
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
}

.side-mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 30;
}
body.side-open .side-mask { display: block; }

@media (max-width: 960px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stats-3 { grid-template-columns: 1fr; }
  .ov-ranks { grid-template-columns: 1fr 1fr; }
  .ov-ranks.cols-3 { grid-template-columns: 1fr; }
  .ov-charts { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .menu-btn { display: inline-flex; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: 8px 0 24px rgba(15, 23, 42, 0.08);
  }
  body.side-open .sidebar { transform: translateX(0); }
}

@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .uname { display: none; }
  .page-head { flex-direction: column; }
}


/* ========== 客户资料面板（企微工具栏） ========== */
.crm-page {
  margin: 0;
  height: 100%;
  min-height: 100%;
  background: #f5f6f8;
  color: #1f2329;
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
html, body.crm-page { height: 100%; }
.crm-shell {
  height: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  background: #f5f6f8;
}
.crm-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: #fff;
  border-bottom: 1px solid #e8eaed;
  position: sticky;
  top: 0;
  z-index: 5;
}
.crm-eyebrow {
  margin: 0;
  font-size: 13px;
  font-weight: 650;
}
.crm-status {
  margin: 1px 0 0;
  font-size: 11px;
  color: #8f959e;
}
.crm-icon-btn {
  border: 1px solid #e5e6eb;
  background: #fff;
  color: #4e5969;
  height: 30px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.crm-icon-btn:disabled { opacity: .45; cursor: not-allowed; }
.crm-icon-btn:hover:not(:disabled) { background: #f7f8fa; }
.crm-top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
a.crm-icon-btn { text-decoration: none; line-height: 28px; }
.crm-main {
  flex: 1;
  min-height: 0;
  padding: 8px 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.crm-block {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(31, 35, 41, 0.04);
}
.crm-profile-block {
  padding: 6px 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}
.crm-block[hidden] { display: none !important; }
.crm-empty {
  padding: 28px 8px;
  text-align: center;
  color: #8f959e;
  font-size: 13px;
}
.crm-empty-sm { padding: 8px 4px; font-size: 12px; }
.crm-empty-err { color: #d93026; }
.crm-profile-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 36px;
  width: 100%;
  text-align: left;
}
#contactSummary,
#groupSummary,
.crm-profile-summary,
.crm-profile-meta,
.crm-profile-meta strong,
.crm-profile-meta span {
  text-align: left;
}
.crm-profile-summary {
  padding: 0;
}
.crm-hero {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
}
.crm-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #e8eaed;
}
.crm-avatar-empty,
.crm-avatar-group {
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  background: linear-gradient(145deg, #4e83fd, #3370ff);
}
.crm-avatar-group {
  border-radius: 8px;
  background: linear-gradient(145deg, #36b37e, #00875a);
  font-size: 12px;
}
.crm-profile-meta,
.crm-hero-text {
  flex: 1;
  min-width: 0;
}
.crm-profile-name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.crm-profile-name strong {
  min-width: 0;
}
.crm-nick {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crm-funnel-tag,
.cr-funnel-tag {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: #eef3ff;
  color: #3370ff;
  font-size: 10px;
  font-style: normal;
  font-weight: 650;
  line-height: 18px;
}
.crm-funnel-tag[hidden] { display: none !important; }
.crm-brain,
.crm-brain-pop {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #f0f1f2;
  max-height: 36vh;
  overflow: auto;
}
.crm-brain[hidden] { display: none !important; }
.crm-open-brain em {
  font-style: normal;
  color: #3370ff;
  font-weight: 650;
}
.crm-brain-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 650;
  color: #1f2329;
}
.crm-brain-head span {
  color: #8f959e;
  font-size: 11px;
  font-weight: 400;
}
.crm-brain-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.crm-brain-li {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-height: 26px;
}
.crm-brain-k {
  color: #8f959e;
  font-size: 11px;
}
.crm-brain-v {
  border: 0;
  padding: 0;
  background: transparent;
  color: #1f2329;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crm-brain-v:hover { color: #3370ff; }
.crm-brain-li em {
  color: #c0c4cc;
  font-size: 10px;
  font-style: normal;
  white-space: nowrap;
}
.crm-brain-stale,
.crm-brain-next,
.crm-brain-asked,
.crm-brain-tip {
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.4;
  color: #8f959e;
}
.crm-brain-stale { color: #de7802; }
.crm-brain-next { color: #3370ff; }
.crm-brain-add {
  margin-top: 8px;
  border: 1px dashed #d0d3d9;
  background: #fff;
  color: #4e5969;
  height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
}
.crm-profile-meta strong,
.crm-hero-text h2 {
  margin: 0;
  display: block;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crm-suggest-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.crm-suggest-nav[hidden] { display: none !important; }
.crm-suggest-btn {
  border: 1px solid #e5e6eb;
  background: #fff;
  color: #4e5969;
  height: 26px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.crm-suggest-btn:disabled { opacity: .4; cursor: not-allowed; }
#suggestNavMeta { font-size: 11px; color: #8f959e; }
.crm-profile-meta span,
.crm-hero-text p {
  margin: 2px 0 0;
  display: block;
  font-size: 11px;
  color: #8f959e;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crm-follow-chip,
.crm-member-chip {
  flex-shrink: 0;
  border: 1px solid #e5e6eb;
  background: #f7f8fa;
  color: #4e5969;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  cursor: pointer;
}
.crm-follow-chip:disabled,
.crm-member-chip:disabled {
  opacity: .55;
  cursor: default;
}
.crm-follow-chip em,
.crm-member-chip em {
  font-style: normal;
  color: #3370ff;
  font-weight: 650;
}
.crm-id-chip {
  display: inline;
  max-width: none;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 10px;
  color: #8f959e;
}
.crm-follow-pop,
.crm-member-pop {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #f0f1f2;
  max-height: 36vh;
  overflow: auto;
}
.crm-chat-block {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 10px 12px 12px;
}
.crm-chat-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 650;
}
.crm-chat-head em {
  font-style: normal;
  font-size: 11px;
  font-weight: 500;
  color: #8f959e;
}
.crm-chat-placeholder,
.crm-chat-thread {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px 8px 12px;
  background: #f7f8fa;
  border: 1px solid #eef0f3;
  border-radius: 8px;
}
.crm-chat-placeholder {
  display: grid;
  place-items: center;
  padding: 20px 12px;
  text-align: center;
  color: #8f959e;
  font-size: 12px;
  line-height: 1.6;
  background: #fafbfc;
  border-style: dashed;
}
.crm-chat-thread .crm-empty {
  padding: 24px 10px;
}
.crm-chat-thread .cr-msg { margin: 8px 0; }
.crm-chat-thread .cr-msg .cr-avatar { width: 28px; height: 28px; }
.crm-chat-thread .cr-bubble { max-width: 78%; }
.crm-chat-thread .cr-msg-text { font-size: 13px; }
.crm-chat-thread .cr-msg-img { max-width: 168px; max-height: 168px; }
.crm-dl { margin: 0; }
.crm-row {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #f5f6f7;
  font-size: 13px;
  line-height: 1.45;
}
.crm-row:last-child { border-bottom: 0; }
.crm-row dt { margin: 0; color: #8f959e; font-weight: 400; }
.crm-row dd { margin: 0; color: #1f2329; word-break: break-word; }
.crm-section { margin-top: 14px; }
.crm-section-h {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 650;
}
.crm-section-h em {
  font-style: normal;
  color: #8f959e;
  font-weight: 500;
  font-size: 12px;
}
.crm-people { display: flex; flex-direction: column; gap: 8px; }
.crm-person {
  border: 1px solid #eef0f3;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fafbfc;
}
.crm-person-head { display: flex; flex-direction: column; gap: 2px; }
.crm-person-head strong { font-size: 13px; font-weight: 600; }
.crm-person-head span { font-size: 11px; color: #8f959e; }
.crm-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.acq-tags { margin-top: 0; }
.crm-tags span {
  font-size: 11px;
  line-height: 1;
  padding: 4px 7px;
  border-radius: 999px;
  background: #eef3ff;
  color: #3370ff;
}
.crm-person .crm-dl { margin-top: 6px; }
.crm-person .crm-row { padding: 5px 0; font-size: 12px; grid-template-columns: 56px 1fr; }
.crm-list { list-style: none; margin: 0; padding: 0; }
.crm-li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid #f5f6f7;
  font-size: 13px;
}
.crm-li:last-child { border-bottom: 0; }
.crm-li-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crm-li-tag {
  flex-shrink: 0;
  font-size: 11px;
  color: #8f959e;
  background: #f2f3f5;
  padding: 3px 7px;
  border-radius: 999px;
}
.crm-link-btn {
  display: inline-flex;
  margin-top: 8px;
  border: 0;
  background: transparent;
  color: #3370ff;
  font-size: 12px;
  padding: 0;
  cursor: pointer;
}
.crm-foot-id {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px dashed #eef0f3;
  font-size: 11px;
  color: #8f959e;
  word-break: break-all;
}
.crm-foot-id code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11px;
  color: #646a73;
}
.crm-composer {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid #e8eaed;
}
.crm-composer textarea {
  width: 100%;
  min-height: 96px;
  max-height: 180px;
  border: 1px solid #e5e6eb;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 13px;
  line-height: 1.55;
  resize: vertical;
  outline: none;
  background: #f7f8fa;
}
.crm-composer textarea:focus {
  border-color: #3370ff;
  background: #fff;
}
.crm-composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}
.crm-composer-tip {
  font-size: 11px;
  color: #8f959e;
  flex: 1;
  min-width: 0;
}
.crm-composer-tip.ok-note { color: #00875a; }
.crm-composer-tip.err-note { color: #d93026; }
.crm-send {
  border: 0;
  background: #3370ff;
  color: #fff;
  height: 32px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.crm-send:disabled { opacity: .45; cursor: not-allowed; }
.crm-send:hover:not(:disabled) { background: #245bdb; }
.crm-debug {
  margin: 0 12px 12px;
  padding: 8px 12px;
  background: #fff;
  border-radius: 10px;
  color: #8f959e;
  font-size: 12px;
}
.crm-debug summary { cursor: pointer; }
.crm-debug pre {
  margin: 8px 0 0;
  padding: 10px;
  background: #1f2329;
  color: #d7dde5;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.45;
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.crm-offline {
  margin: 24px 16px;
  text-align: center;
  color: #8f959e;
  font-size: 13px;
}
.wecom-fill-tip {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(12px);
  z-index: 40;
  max-width: calc(100% - 32px);
  padding: 8px 12px;
  border-radius: 8px;
  background: #1f2329;
  color: #fff;
  font-size: 12px;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.wecom-fill-tip.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.wecom-fill-tip.ok { background: #00875a; }

.app-body.cr-full .content-scroll {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.app-body.cr-full .content {
  width: 100%;
  max-width: none;
  flex: 1;
  min-height: 0;
  height: 100%;
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
}
.cr-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cr-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}
.cr-toolbar-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}
.cr-toolbar-main strong { font-size: 16px; }
.cr-toolbar-meta,
.cr-toolbar-note {
  font-size: 12px;
  color: var(--muted);
}
.cr-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.cr-board {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 260px 280px minmax(0, 1fr);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.cr-col {
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
}
.cr-col:last-child { border-right: 0; }
.cr-col-head {
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cr-tabs {
  display: flex;
  gap: 6px;
}
.cr-tabs button,
.cr-tabs-static span {
  border: 0;
  background: #f3f5f7;
  color: #4b5563;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.cr-tabs button.on,
.cr-tabs-static span.on {
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-weight: 600;
}
.cr-col-head input {
  width: 100%;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  font: inherit;
  font-size: 13px;
  outline: none;
}
.cr-col-head input:focus { border-color: #93c5fd; }
.cr-list {
  flex: 1;
  overflow: auto;
}
.cr-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.cr-item:hover { background: #f7f8fa; }
.cr-item.on { background: #eef4ff; }
.cr-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #e8eaed;
}
.cr-avatar-fallback {
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  background: linear-gradient(145deg, #60a5fa, #2563eb);
}
.cr-item-main { min-width: 0; flex: 1; }
.cr-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.cr-item-top strong {
  font-size: 13px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cr-item-top em,
.cr-item-main p {
  font-style: normal;
  color: var(--muted);
  font-size: 11px;
}
.cr-item-top em {
  white-space: nowrap;
  flex-shrink: 0;
}
.cr-item-main p {
  margin: 3px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cr-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.cr-thread-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}
.cr-thread-avatar .cr-avatar,
.cr-thread-avatar.cr-avatar {
  width: 36px;
  height: 36px;
}
.cr-thread-head strong { font-size: 15px; }
.cr-thread-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.cr-thread-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.cr-thread-body {
  flex: 1;
  overflow: auto;
  padding: 16px;
  background: #f7f8fa;
}
.cr-msg { display: flex; margin: 10px 0; align-items: flex-start; gap: 8px; }
.cr-msg.peer { justify-content: flex-start; }
.cr-msg.staff { justify-content: flex-end; }
.cr-msg.staff .cr-avatar { order: 2; }
.cr-msg .cr-avatar { width: 32px; height: 32px; }
.cr-bubble {
  max-width: min(72%, 560px);
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
}
.cr-msg.staff .cr-bubble {
  background: var(--blue-soft);
  border-color: #bfdbfe;
}
.cr-msg-name {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
  display: flex;
  gap: 8px;
}
.cr-msg-name em { font-style: normal; white-space: nowrap; flex-shrink: 0; }
.cr-msg-text {
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.cr-msg-type { color: var(--blue-dark); }
.cr-msg-img-link { display: inline-block; }
.cr-msg-img {
  display: block;
  max-width: 220px;
  max-height: 220px;
  border-radius: 8px;
  object-fit: cover;
  background: #e8eaed;
  min-width: 72px;
  min-height: 72px;
}
.cr-older-hint,
.cr-newer-gap {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 8px 0;
}
.cr-msg-video {
  display: block;
  max-width: 240px;
  max-height: 180px;
  border-radius: 8px;
  background: #000;
}
.cr-voice {
  border: 0;
  background: #e8f1ff;
  color: #1d4ed8;
  border-radius: 16px;
  padding: 6px 12px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}
.cr-msg.staff .cr-voice { background: #dbeafe; }
.cr-voice-audio { display: block; margin-top: 8px; width: 220px; }
.cr-msg-file { color: var(--blue-dark); }
.cr-asr-text {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.5;
  color: #334155;
  white-space: pre-wrap;
  word-break: break-word;
}
.cr-asr-fail {
  color: #94a3b8;
  font-size: 12px;
}
.cr-asr-wait {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}
@media (max-width: 1100px) {
  .cr-board { grid-template-columns: 220px 230px minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .cr-board {
    grid-template-columns: 1fr;
    overflow: auto;
  }
  .cr-col { min-height: 240px; border-right: 0; border-bottom: 1px solid var(--line); }
  .cr-toolbar { flex-direction: column; align-items: flex-start; }
}
