/* ==========================================================================
   销客 CRM · 设计系统
   ========================================================================== */
:root {
  --brand: #4f46e5;
  --brand-600: #4338ca;
  --brand-50: #eef2ff;
  --brand-100: #e0e7ff;
  --success: #10b981;
  --success-50: #ecfdf5;
  --warning: #f59e0b;
  --warning-50: #fffbeb;
  --danger: #ef4444;
  --danger-50: #fef2f2;
  --info: #0ea5e9;
  --info-50: #f0f9ff;
  --purple: #8b5cf6;
  --cyan: #06b6d4;

  --bg: #f6f7fb;
  --card: #ffffff;
  --border: #e6e8f0;
  --border-strong: #d3d7e3;
  --text: #1a1f36;
  --text-2: #5a6178;
  --text-3: #8b91a6;
  --text-4: #b3b8c8;

  --radius: 14px;
  --radius-sm: 9px;
  --radius-xs: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, .07), 0 2px 4px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12), 0 4px 8px rgba(16, 24, 40, .05);
  --sidebar-w: 232px;
  --topbar-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d6dae6; border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #bcc2d3; background-clip: content-box; }

/* ---------- 布局 ---------- */
#app { display: flex; height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: linear-gradient(180deg, #131a2b 0%, #0b1220 100%);
  color: #cbd2e0;
  display: flex;
  flex-direction: column;
  transition: width .18s ease, flex-basis .18s ease;
  z-index: 30;
}
.sidebar-brand {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  flex: 0 0 var(--topbar-h);
}
.brand-mark {
  width: 30px; height: 30px; flex: 0 0 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 15px;
  box-shadow: 0 2px 8px rgba(79, 70, 229, .45);
}
.brand-text { font-size: 15px; font-weight: 600; color: #fff; letter-spacing: .3px; white-space: nowrap; }
.brand-sub { font-size: 10.5px; color: #6b7690; letter-spacing: .5px; margin-top: -3px; white-space: nowrap; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.nav-group-label {
  font-size: 10.5px; letter-spacing: .8px; color: #5c6785;
  padding: 10px 10px 6px; text-transform: uppercase; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; margin-bottom: 2px;
  border-radius: 9px; color: #a9b2c7;
  font-size: 13.5px; font-weight: 500;
  cursor: pointer; user-select: none;
  transition: background .14s, color .14s;
  position: relative;
  white-space: nowrap;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #e6eaf3; text-decoration: none; }
.nav-item.active { background: linear-gradient(90deg, rgba(79, 70, 229, .9), rgba(79, 70, 229, .62)); color: #fff; box-shadow: 0 3px 10px rgba(79, 70, 229, .3); }
.nav-item.active::before {
  content: ''; position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: #fff;
}
.nav-item svg { flex: 0 0 17px; opacity: .9; }
.nav-item .nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-badge {
  font-size: 10.5px; font-weight: 700; line-height: 1;
  padding: 3px 6px; border-radius: 20px;
  background: var(--danger); color: #fff; min-width: 18px; text-align: center;
}
.nav-badge.warn { background: var(--warning); }
.nav-badge.gray { background: rgba(255, 255, 255, .14); color: #cbd2e0; }

.sidebar-foot {
  padding: 10px 14px; border-top: 1px solid rgba(255, 255, 255, .06);
  font-size: 11px; color: #5c6785; display: flex; align-items: center; justify-content: space-between;
}
.sidebar-foot .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--success); margin-right: 5px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px; z-index: 20;
}
.topbar-title { font-size: 15px; font-weight: 650; letter-spacing: .2px; }
.topbar-title small { display: block; font-size: 11.5px; font-weight: 400; color: var(--text-3); margin-top: -2px; }
.topbar-spacer { flex: 1; }

.search-trigger {
  display: flex; align-items: center; gap: 8px;
  width: 260px; height: 34px; padding: 0 12px;
  background: #f3f4f8; border: 1px solid transparent; border-radius: 9px;
  color: var(--text-3); font-size: 13px; cursor: pointer;
  transition: .15s;
}
.search-trigger:hover { background: #eef0f6; border-color: var(--border-strong); }
.search-trigger kbd {
  margin-left: auto; font-family: inherit; font-size: 10.5px; color: var(--text-3);
  background: #fff; border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px;
}

.icon-btn {
  position: relative;
  width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid transparent; background: transparent; color: var(--text-2);
  display: grid; place-items: center; transition: .15s;
}
.icon-btn:hover { background: #f3f4f8; color: var(--text); }
.icon-btn .badge-dot {
  position: absolute; top: 3px; right: 3px; min-width: 15px; height: 15px;
  border-radius: 8px; background: var(--danger); color: #fff;
  font-size: 9.5px; font-weight: 700; line-height: 15px; text-align: center; padding: 0 3px;
  border: 1.5px solid #fff;
}

.user-chip {
  display: flex; align-items: center; gap: 9px; padding: 4px 8px 4px 4px;
  border-radius: 24px; cursor: pointer; transition: .15s;
}
.user-chip:hover { background: #f3f4f8; }
.user-chip .u-name { font-size: 12.5px; font-weight: 600; line-height: 1.2; }
.user-chip .u-role { font-size: 10.5px; color: var(--text-3); line-height: 1.2; }

.view {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 22px 24px 40px;
  position: relative;
}

/* ---------- 通用块 ---------- */
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.page-head h1 { font-size: 20px; font-weight: 680; letter-spacing: -.2px; }
.page-head .sub { color: var(--text-3); font-size: 12.5px; margin-top: 3px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 14px; font-weight: 650; }
.card-head .sub { font-size: 11.5px; color: var(--text-3); }
.card-head .actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.card-body { padding: 20px; }
.card-body.tight { padding: 12px 20px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.spacer { flex: 1; }
.mt-0 { margin-top: 0 } .mt-4 { margin-top: 4px } .mt-8 { margin-top: 8px } .mt-12 { margin-top: 12px }
.mt-16 { margin-top: 16px } .mt-20 { margin-top: 20px } .mt-24 { margin-top: 24px }
.mb-0 { margin-bottom: 0 } .mb-8 { margin-bottom: 8px } .mb-12 { margin-bottom: 12px } .mb-16 { margin-bottom: 16px }
.text-2 { color: var(--text-2) } .text-3 { color: var(--text-3) } .text-sm { font-size: 12px }
.text-xs { font-size: 11px } .text-lg { font-size: 16px } .text-xl { font-size: 19px }
.fw-6 { font-weight: 600 } .fw-7 { font-weight: 700 }
.mono { font-variant-numeric: tabular-nums; }
.center { text-align: center }
.right { text-align: right }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hr { height: 1px; background: var(--border); margin: 16px 0; border: 0; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: #fff; color: var(--text);
  font-size: 13px; font-weight: 550; white-space: nowrap;
  transition: .15s; user-select: none;
}
.btn:hover { background: #f7f8fb; border-color: #c3c9d9; }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { flex: 0 0 auto; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 1px 3px rgba(79, 70, 229, .35); }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: #f3f4f8; color: var(--text); }
.btn-danger { color: var(--danger); border-color: #f6c9c9; background: var(--danger-50); }
.btn-danger:hover { background: #fee2e2; border-color: #f0a8a8; }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: #dc2626; }
.btn-sm { height: 28px; padding: 0 9px; font-size: 12px; border-radius: 7px; }
.btn-lg { height: 40px; padding: 0 18px; font-size: 14px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-icon { width: 34px; padding: 0; }
.btn-icon.btn-sm { width: 28px; }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field > label .req { color: var(--danger); margin-left: 2px; }
.field .hint { font-size: 11px; color: var(--text-3); }
.input, .select, .textarea {
  width: 100%; height: 34px; padding: 0 11px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: #fff; outline: none; transition: .15s;
  font-size: 13px;
}
.textarea { height: auto; min-height: 76px; padding: 9px 11px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
.input::placeholder, .textarea::placeholder { color: var(--text-4); }
.input:disabled, .select:disabled { background: #f6f7fb; color: var(--text-3); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b91a6' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }
.input-sm, .select-sm { height: 30px; font-size: 12.5px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-full { grid-column: 1 / -1; }

.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 13px; user-select: none; }
.check input { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 28px; padding: 0 11px; border-radius: 20px;
  border: 1px solid var(--border-strong); background: #fff;
  font-size: 12.5px; color: var(--text-2); cursor: pointer; transition: .15s;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.active { background: var(--brand-50); border-color: var(--brand); color: var(--brand-600); font-weight: 600; }
.chip-close { opacity: .55; margin-left: 1px; }
.chip-close:hover { opacity: 1; }

/* ---------- 徽标 / 标签 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 21px; padding: 0 8px; border-radius: 6px;
  font-size: 11.5px; font-weight: 600; line-height: 21px; white-space: nowrap;
  background: #f1f3f8; color: var(--text-2);
}
.badge.gray { background: #f1f3f8; color: #5a6178; }
.badge.blue { background: #eef2ff; color: #4338ca; }
.badge.green { background: #ecfdf5; color: #047857; }
.badge.amber { background: #fffbeb; color: #b45309; }
.badge.red { background: #fef2f2; color: #b91c1c; }
.badge.purple { background: #f5f3ff; color: #6d28d9; }
.badge.cyan { background: #ecfeff; color: #0e7490; }
.badge.solid { background: var(--brand); color: #fff; }
.badge.lg { height: 24px; line-height: 24px; font-size: 12px; padding: 0 10px; }

.tag {
  display: inline-flex; align-items: center;
  height: 20px; padding: 0 7px; border-radius: 5px;
  font-size: 11px; background: #f1f3f8; color: #5a6178;
  border: 1px solid #e9ebf2; white-space: nowrap;
}
.tag.primary { background: var(--brand-50); color: var(--brand-600); border-color: var(--brand-100); }
.tag.green { background: var(--success-50); color: #047857; border-color: #d1fae5; }
.tag.amber { background: var(--warning-50); color: #b45309; border-color: #fde68a; }
.tag.red { background: var(--danger-50); color: #b91c1c; border-color: #fecaca; }

.dot-badge { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }

/* ---------- 头像 ---------- */
.avatar {
  display: inline-grid; place-items: center; flex: 0 0 auto;
  border-radius: 50%; color: #fff; font-weight: 650; letter-spacing: .3px;
  background: var(--brand); user-select: none;
}
.avatar.sq { border-radius: 8px; }
.avatar-ring { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px rgba(79, 70, 229, .18); }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { margin-left: -7px; border: 2px solid #fff; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.tbl thead th {
  text-align: left; font-size: 11.5px; font-weight: 600; color: var(--text-3);
  padding: 10px 14px; background: #fafbfd;
  border-bottom: 1px solid var(--border);
  white-space: nowrap; position: sticky; top: 0; z-index: 2;
}
.tbl thead th:first-child { border-top-left-radius: var(--radius); padding-left: 20px; }
.tbl thead th:last-child { border-top-right-radius: var(--radius); padding-right: 20px; }
.tbl tbody td { padding: 11px 14px; border-bottom: 1px solid #f1f3f8; vertical-align: middle; }
.tbl tbody td:first-child { padding-left: 20px; }
.tbl tbody td:last-child { padding-right: 20px; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: #f8f9fd; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl .cell-main { font-weight: 600; color: var(--text); }
.tbl .cell-sub { font-size: 11.5px; color: var(--text-3); }
.tbl .num { font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- KPI ---------- */
.kpi { padding: 18px 20px; position: relative; overflow: hidden; }
.kpi .label { font-size: 12px; color: var(--text-3); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 25px; font-weight: 700; letter-spacing: -.5px; margin-top: 7px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi .value small { font-size: 13px; font-weight: 600; color: var(--text-3); margin-left: 2px; }
.kpi .foot { font-size: 11.5px; color: var(--text-3); margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.kpi .kpi-icon {
  position: absolute; right: 16px; top: 16px;
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center; opacity: .95;
}
.delta-up { color: var(--success); font-weight: 600; }
.delta-down { color: var(--danger); font-weight: 600; }

/* ---------- 空态 / 加载 ---------- */
.empty { padding: 52px 20px; text-align: center; color: var(--text-3); }
.empty .ico { margin-bottom: 12px; color: var(--text-4); }
.empty h4 { font-size: 14px; color: var(--text-2); margin-bottom: 4px; font-weight: 600; }
.empty p { font-size: 12.5px; max-width: 340px; margin: 0 auto 14px; line-height: 1.7; }

.spinner { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 60px 0; color: var(--text-3); font-size: 13px; }
.spinner::before {
  content: ''; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--brand);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, #f1f3f8 25%, #e8ebf3 37%, #f1f3f8 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 100% 50% } 100% { background-position: 0 50% } }

/* ---------- 模态 / 抽屉 ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .42);
  z-index: 100; display: flex; align-items: center; justify-content: center;
  padding: 24px; animation: fade .16s ease;
  backdrop-filter: blur(2px);
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px) scale(.99) } to { opacity: 1; transform: none } }
@keyframes slideInRight { from { transform: translateX(36px); opacity: .6 } to { transform: none; opacity: 1 } }

.modal {
  background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg);
  width: 560px; max-width: 100%; max-height: calc(100vh - 60px);
  display: flex; flex-direction: column; animation: slideUp .2s cubic-bezier(.2, .8, .3, 1);
}
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 22px 0; }
.modal-head h3 { font-size: 16px; font-weight: 680; }
.modal-head .sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.modal-head .close { margin-left: auto; }
.modal-body { padding: 18px 22px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 9px; justify-content: flex-end; background: #fcfcfe; border-radius: 0 0 16px 16px; }

.drawer-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .34);
  z-index: 100; display: flex; justify-content: flex-end;
  animation: fade .16s ease; backdrop-filter: blur(1.5px);
}
.drawer {
  background: #fff; width: 720px; max-width: 94vw; height: 100%;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
  animation: slideInRight .22s cubic-bezier(.2, .8, .3, 1);
}
.drawer-head { padding: 20px 24px 14px; border-bottom: 1px solid var(--border); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px; }
.drawer-foot { padding: 13px 24px; border-top: 1px solid var(--border); display: flex; gap: 9px; justify-content: flex-end; background: #fcfcfe; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: #1f2937; color: #fff; padding: 9px 16px; border-radius: 9px;
  font-size: 13px; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 8px;
  animation: toastIn .22s cubic-bezier(.2, .8, .3, 1);
  max-width: 460px;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px) } to { opacity: 1; transform: none } }
.toast.success { background: #065f46; }
.toast.error { background: #991b1b; }
.toast.warning { background: #92400e; }
.toast.info { background: #1e3a8a; }

/* ---------- 标签页 ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab {
  padding: 9px 14px; font-size: 13px; font-weight: 550; color: var(--text-3);
  border: 0; border-bottom: 2px solid transparent; background: transparent;
  cursor: pointer; white-space: nowrap; font-family: inherit;
  transition: .14s; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab .count { font-size: 11px; background: #f1f3f8; padding: 1px 6px; border-radius: 10px; margin-left: 5px; color: var(--text-3); }
.tab.active .count { background: var(--brand-50); color: var(--brand); }

.seg { display: inline-flex; background: #f1f3f8; border-radius: 9px; padding: 3px; gap: 2px; }
.seg-item {
  padding: 5px 12px; border-radius: 7px; font-size: 12.5px; font-weight: 550;
  color: var(--text-2); cursor: pointer; transition: .14s; border: 0; background: transparent;
  display: inline-flex; align-items: center; gap: 5px;
}
.seg-item:hover { color: var(--text); }
.seg-item.active { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(16, 24, 40, .1); }

/* ---------- 工具栏 ---------- */
.toolbar { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search-box { position: relative; width: 240px; }
.toolbar .search-box svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.toolbar .search-box .input { padding-left: 31px; }

/* ---------- 看板 ---------- */
.kanban { display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; padding-bottom: 14px; min-height: 420px; }
.kanban-col {
  flex: 0 0 282px; width: 282px;
  background: #f3f4f9; border-radius: 12px; border: 1px solid #eceef6;
  display: flex; flex-direction: column; max-height: calc(100vh - 250px);
  transition: background .15s, border-color .15s;
}
.kanban-col.drag-over { background: var(--brand-50); border-color: #c7d2fe; border-style: dashed; }
.kanban-col-head { padding: 11px 13px; display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.kanban-col-head .name { font-size: 12.5px; font-weight: 650; }
.kanban-col-head .cnt { font-size: 11px; color: var(--text-3); background: #e6e9f2; padding: 1px 7px; border-radius: 10px; font-weight: 600; }
.kanban-col-head .amt { margin-left: auto; font-size: 11.5px; color: var(--text-3); font-weight: 600; font-variant-numeric: tabular-nums; }
.kanban-list { flex: 1; overflow-y: auto; padding: 0 9px 10px; display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.kcard {
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 12px; cursor: grab; transition: .15s; box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  position: relative;
}
.kcard:hover { box-shadow: var(--shadow-md); border-color: #d6daf0; transform: translateY(-1px); }
.kcard:active { cursor: grabbing; }
.kcard.dragging { opacity: .45; }
.kcard .kc-title { font-size: 12.5px; font-weight: 650; line-height: 1.45; margin-bottom: 7px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kcard .kc-amt { font-size: 14px; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.kcard .kc-meta { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 11px; color: var(--text-3); }
.kcard .kc-foot { display: flex; align-items: center; gap: 5px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed #eef0f6; }
.kcard .kc-foot .spacer { flex: 1 }
.kcard .kc-cust { font-size: 11px; color: var(--text-2); margin-bottom: 4px; display: flex; align-items: center; gap: 4px; }

/* ---------- 时间线 ---------- */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(180deg, var(--border), #f1f3f8); border-radius: 2px; }
.tl-item { position: relative; padding-bottom: 18px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot {
  position: absolute; left: -26px; top: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 2px solid var(--border-strong);
  display: grid; place-items: center; color: var(--text-3);
}
.tl-dot.primary { border-color: var(--brand); color: var(--brand); background: var(--brand-50); }
.tl-dot.green { border-color: var(--success); color: var(--success); background: var(--success-50); }
.tl-dot.amber { border-color: var(--warning); color: var(--warning); background: var(--warning-50); }
.tl-dot.red { border-color: var(--danger); color: var(--danger); background: var(--danger-50); }
.tl-dot.purple { border-color: var(--purple); color: var(--purple); background: #f5f3ff; }
.tl-head { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; flex-wrap: wrap; }
.tl-title { font-size: 12.5px; font-weight: 650; }
.tl-time { font-size: 11px; color: var(--text-3); }
.tl-body { font-size: 12.5px; color: var(--text-2); line-height: 1.65; background: #fafbfd; border-radius: 8px; padding: 8px 11px; margin-top: 5px; border: 1px solid #f0f2f7; }
.tl-body.plain { background: transparent; border: 0; padding: 0; }

/* ---------- 列表行 ---------- */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 20px; border-bottom: 1px solid #f1f3f8;
  transition: background .12s;
}
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: #fafbfd; }
.list-item.clickable { cursor: pointer; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-size: 13px; font-weight: 600; }
.list-item .li-sub { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.list-item .li-right { margin-left: auto; text-align: right; flex: 0 0 auto; }

/* ---------- 进度条 ---------- */
.progress { height: 6px; background: #eef0f6; border-radius: 4px; overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 4px; background: var(--brand); transition: width .4s ease; }
.progress.green > i { background: var(--success); }
.progress.amber > i { background: var(--warning); }
.progress.red > i { background: var(--danger); }

/* ---------- 详情页 ---------- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.info-list { display: grid; grid-template-columns: 92px 1fr; gap: 9px 12px; font-size: 12.5px; }
.info-list dt { color: var(--text-3); }
.info-list dd { margin: 0; color: var(--text); word-break: break-all; }
.stat-strip { display: flex; border: 1px solid var(--border); border-radius: 11px; overflow: hidden; background: #fcfcfe; }
.stat-strip > div { flex: 1; padding: 11px 14px; border-right: 1px solid var(--border); }
.stat-strip > div:last-child { border-right: 0; }
.stat-strip .k { font-size: 10.5px; color: var(--text-3); }
.stat-strip .v { font-size: 16px; font-weight: 700; margin-top: 1px; font-variant-numeric: tabular-nums; }

/* ---------- 图表 ---------- */
.chart { width: 100%; display: block; overflow: visible; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 11.5px; color: var(--text-2); margin-top: 10px; }
.chart-legend .lg-item { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend .sw { width: 9px; height: 9px; border-radius: 3px; }

/* ---------- 日历 ---------- */
.cal { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #fff; }
.cal-head-row { display: grid; grid-template-columns: repeat(7, 1fr); background: #fafbfd; border-bottom: 1px solid var(--border); }
.cal-head-row div { padding: 8px; text-align: center; font-size: 11.5px; font-weight: 600; color: var(--text-3); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-cell {
  min-height: 124px; border-right: 1px solid #f1f3f8; border-bottom: 1px solid #f1f3f8;
  padding: 6px 7px; position: relative; transition: background .12s;
}
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.other { background: #fcfcfe; }
.cal-cell.today { background: #f5f6ff; }
.cal-cell:hover { background: #fafbff; }
.cal-date { font-size: 11.5px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; display: flex; align-items: center; gap: 4px; }
.cal-cell.today .cal-date { color: var(--brand); }
.cal-cell.today .cal-date::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--brand); }
.cal-ev {
  font-size: 10.5px; padding: 2px 5px; border-radius: 4px; margin-bottom: 2px;
  background: var(--brand-50); color: var(--brand-600);
  cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border-left: 2px solid var(--brand);
}
.cal-ev.done { background: #f4f5f8; color: var(--text-3); text-decoration: line-through; border-left-color: var(--text-4); }
.cal-ev.red { background: var(--danger-50); color: #b91c1c; border-left-color: var(--danger); }
.cal-ev.green { background: var(--success-50); color: #047857; border-left-color: var(--success); }
.cal-more { font-size: 10px; color: var(--text-3); padding-left: 3px; }

/* ---------- 搜索面板 ---------- */
.cmdk { position: fixed; inset: 0; z-index: 200; background: rgba(15, 23, 42, .4); display: flex; justify-content: center; padding-top: 12vh; animation: fade .15s; backdrop-filter: blur(2px); }
.cmdk-box { width: 620px; max-width: 92vw; background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg); height: fit-content; max-height: 70vh; display: flex; flex-direction: column; animation: slideUp .18s; overflow: hidden; }
.cmdk-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.cmdk-input input { flex: 1; border: 0; outline: 0; font-size: 15px; background: transparent; }
.cmdk-res { overflow-y: auto; padding: 8px; }
.cmdk-group { font-size: 10.5px; color: var(--text-3); font-weight: 700; letter-spacing: .6px; padding: 8px 10px 4px; }
.cmdk-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.cmdk-item:hover, .cmdk-item.sel { background: #f5f6fb; }
.cmdk-item .ci-main { flex: 1; min-width: 0; }
.cmdk-item .ci-title { font-size: 13px; font-weight: 550; }
.cmdk-item .ci-sub { font-size: 11px; color: var(--text-3); }
.cmdk-foot { padding: 8px 14px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-3); display: flex; gap: 14px; background: #fcfcfe; }

/* ---------- 提醒面板 ---------- */
.remind-panel { position: fixed; top: 60px; right: 16px; width: 366px; max-height: 76vh; z-index: 90; background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slideUp .16s; overflow: hidden; }
.remind-head { padding: 13px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.remind-body { overflow-y: auto; }
.remind-section { padding: 10px 16px 6px; }
.remind-section .rh { font-size: 11px; font-weight: 700; color: var(--text-3); letter-spacing: .4px; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.remind-row { display: flex; align-items: flex-start; gap: 9px; padding: 8px 0; border-bottom: 1px dashed #f1f3f8; cursor: pointer; }
.remind-row:last-child { border-bottom: 0; }
.remind-row:hover .rr-title { color: var(--brand); }
.remind-row .rr-title { font-size: 12.5px; font-weight: 550; line-height: 1.45; }
.remind-row .rr-sub { font-size: 11px; color: var(--text-3); margin-top: 1px; }

/* ---------- 杂项 ---------- */
.link-btn { color: var(--brand); font-size: 12.5px; font-weight: 550; cursor: pointer; background: none; border: 0; padding: 0; }
.link-btn:hover { text-decoration: underline; }
.muted-box { background: #fafbfd; border: 1px solid #f0f2f7; border-radius: 9px; padding: 10px 13px; font-size: 12px; color: var(--text-2); }
.alert { display: flex; gap: 9px; padding: 10px 13px; border-radius: 9px; font-size: 12.5px; line-height: 1.6; align-items: flex-start; }
.alert.warn { background: var(--warning-50); border: 1px solid #fde68a; color: #92400e; }
.alert.info { background: var(--info-50); border: 1px solid #bae6fd; color: #075985; }
.alert.danger { background: var(--danger-50); border: 1px solid #fecaca; color: #991b1b; }
.alert.success { background: var(--success-50); border: 1px solid #a7f3d0; color: #065f46; }
.alert svg { flex: 0 0 auto; margin-top: 1px; }

.pill-group { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 9px; overflow: hidden; }
.pill-group > button { border: 0; background: #fff; padding: 6px 12px; font-size: 12.5px; color: var(--text-2); border-right: 1px solid var(--border); display: inline-flex; align-items: center; gap: 5px; }
.pill-group > button:last-child { border-right: 0; }
.pill-group > button:hover { background: #f7f8fb; }
.pill-group > button.active { background: var(--brand); color: #fff; }
.pill-group > button.active svg { color: #fff; }

.bulkbar {
  position: sticky; bottom: 16px; margin: 14px auto 0; width: fit-content;
  background: #1f2937; color: #fff; border-radius: 12px;
  padding: 9px 14px; display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow-lg); font-size: 12.5px; z-index: 12;
  animation: slideUp .18s;
}
.bulkbar .btn { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .16); color: #fff; height: 28px; font-size: 12px; }
.bulkbar .btn:hover { background: rgba(255, 255, 255, .2); }
.bulkbar .cnt { font-weight: 700; color: #a5b4fc; }

.owner-cell { display: flex; align-items: center; gap: 7px; min-width: 0; }
.owner-cell .name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.level-badge { width: 20px; height: 20px; border-radius: 6px; display: inline-grid; place-items: center; font-size: 10.5px; font-weight: 700; flex: 0 0 20px; }
.level-A { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.level-B { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.level-C { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.level-D { background: #f4f5f8; color: #6b7280; border: 1px solid #e5e7eb; }

.tbl-mini { width: 100%; font-size: 12.5px; border-collapse: collapse; }
.tbl-mini th { text-align: left; font-size: 11px; color: var(--text-3); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.tbl-mini td { padding: 8px; border-bottom: 1px solid #f4f5f9; }
.tbl-mini tr:last-child td { border-bottom: 0; }

/* 响应式 */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  :root { --sidebar-w: 64px; }
  .sidebar .brand-text, .sidebar .brand-sub, .sidebar .nav-label, .sidebar .nav-group-label, .sidebar .nav-badge, .sidebar-foot span:last-child { display: none; }
  .sidebar-brand { justify-content: center; padding: 0; }
  .nav-item { justify-content: center; padding: 11px; }
  .nav-item.active::before { display: none; }
  .sidebar-foot { justify-content: center; }
  .grid-3, .grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .sidebar { display: none; }
  .view { padding: 16px 14px 40px; }
  .topbar { padding: 0 14px; gap: 10px; }
  .search-trigger { width: 38px; padding: 0; justify-content: center; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .page-head { flex-wrap: wrap; }
  .page-head .actions { width: 100%; margin-left: 0; }
  .drawer { width: 100%; max-width: 100%; }
  .tbl thead { display: none; }
  .tbl tbody td { display: block; padding: 4px 14px; border: 0; }
  .tbl tbody tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--border); }
  .kanban { gap: 10px; }
  .kanban-col { flex-basis: 260px; width: 260px; }
}

/* ============================================================
   page.js 构件兼容层
   page.js 输出 .page-actions/.kpi-grid/.kpi-label… 等别名，
   与上面设计系统的真实类名对齐，避免「helper 无样式」。
   ============================================================ */
.page-head .page-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-head .card-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.card-body-flush { padding: 0; }
.card-body-flush > .tbl thead th:first-child,
.card-body-flush > .tbl tbody td:first-child { padding-left: 20px; }
.card-body-flush > .tbl thead th:last-child,
.card-body-flush > .tbl tbody td:last-child { padding-right: 20px; }

.kpi-grid { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.kpi-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-grid.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi-top { display: flex; align-items: center; gap: 6px; }
.kpi-label { font-size: 12px; color: var(--text-3); font-weight: 500; }
.kpi-value { font-size: 25px; font-weight: 700; letter-spacing: -.5px; margin-top: 7px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi-value small { font-size: 13px; font-weight: 600; color: var(--text-3); margin-left: 2px; }
.kpi-foot { font-size: 11.5px; color: var(--text-3); margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.kpi .kpi-ic {
  position: absolute; right: 16px; top: 16px;
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center; opacity: .95;
  background: var(--brand-soft); color: var(--brand);
}
.kpi.tone-green .kpi-ic { background: #e8f7f0; color: var(--success); }
.kpi.tone-amber .kpi-ic { background: #fef5e7; color: var(--warning); }
.kpi.tone-red .kpi-ic { background: #fdecee; color: var(--danger); }
.kpi.tone-blue .kpi-ic { background: #eaf1fe; color: var(--info); }

.toolbar .tb-left { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.toolbar .tb-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.segmented { display: inline-flex; background: #f1f3f8; border-radius: 9px; padding: 3px; gap: 2px; }
.segmented .seg {
  padding: 6px 13px; border: 0; background: transparent; border-radius: 7px;
  font-size: 12.5px; font-weight: 500; color: var(--text-2); cursor: pointer;
  font-family: inherit; display: inline-flex; align-items: center; gap: 6px; transition: .15s;
}
.segmented .seg:hover { color: var(--text); }
.segmented .seg.active { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(16, 24, 40, .1); font-weight: 600; }
.segmented .seg-n { font-size: 10.5px; padding: 0 5px; border-radius: 20px; background: rgba(15,23,42,.07); color: var(--text-3); min-width: 16px; text-align: center; }
.segmented .seg.active .seg-n { background: var(--brand-soft); color: var(--brand); }
.segmented.sm .seg { padding: 4px 9px; font-size: 12px; }

.text-danger { color: var(--danger) !important; }
.text-warn { color: var(--warning) !important; }
.fw6 { font-weight: 600; }

@media (max-width: 1100px) {
  .kpi-grid, .kpi-grid.cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .kpi-grid, .kpi-grid.cols-3, .kpi-grid.cols-5 { grid-template-columns: 1fr; }
  .page-head .page-actions { width: 100%; margin-left: 0; }
  .toolbar .tb-right { margin-left: 0; width: 100%; }
}

/* ============================================================
   别名兼容层（app.js / page.js / forms.js / 部分页面使用的类名
   与上面设计系统的真实类名对齐，避免「有结构无样式」）
   ============================================================ */

/* ---- 侧边栏（app.js 用 sb-*） ---- */
.sb-brand {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px; border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.sb-brand .logo {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 9px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 15px;
  box-shadow: 0 2px 8px rgba(79, 70, 229, .45);
}
.sb-brand .brand-text { display: flex; flex-direction: column; min-width: 0; }
.sb-brand .brand-text strong { font-size: 14px; font-weight: 650; color: #fff; letter-spacing: .3px; line-height: 1.2; white-space: nowrap; }
.sb-brand .brand-text span { font-size: 10px; color: #6b7690; letter-spacing: .4px; white-space: nowrap; margin-top: 1px; }

.sb-nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.sb-nav .nav-group {
  font-size: 10.5px; letter-spacing: .8px; color: #5c6785;
  padding: 12px 10px 6px; font-weight: 600;
}
.sb-nav .nav-group:first-child { padding-top: 2px; }
.sb-nav .nav-item .label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.sb-nav .nav-item .ic { display: flex; flex: 0 0 17px; opacity: .92; }

.sb-foot {
  padding: 10px 12px; border-top: 1px solid rgba(255, 255, 255, .06);
}
.sb-user {
  width: 100%; display: flex; align-items: center; gap: 9px;
  padding: 6px 8px; border: 0; border-radius: 10px;
  background: rgba(255, 255, 255, .05); color: #cbd2e0;
  font-family: inherit; cursor: pointer; transition: background .14s;
  text-align: left;
}
.sb-user:hover { background: rgba(255, 255, 255, .1); }
.sb-user .uinfo { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sb-user .uinfo strong { font-size: 12.5px; font-weight: 600; color: #fff; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user .uinfo em { font-size: 10.5px; font-style: normal; color: #7b869e; line-height: 1.25; }
.sb-user > svg { opacity: .5; flex: 0 0 14px; }

/* ---- 顶栏搜索按钮（app.js 用 tb-search） ---- */
.tb-search {
  display: flex; align-items: center; gap: 8px;
  width: 300px; height: 34px; padding: 0 12px;
  background: #f3f4f8; border: 1px solid transparent; border-radius: 9px;
  color: var(--text-3); font-size: 13px; cursor: pointer;
  transition: background .15s, border-color .15s;
  flex: 0 1 auto;
}
.tb-search:hover { background: #eef0f6; border-color: var(--border-strong); }
.tb-search span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.tb-search kbd {
  font-family: inherit; font-size: 10.5px; color: var(--text-3);
  background: #fff; border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px;
}
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
#btn-bell .dot {
  position: absolute; top: 7px; right: 7px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--danger); border: 1.5px solid #fff;
}

/* ---- 命令面板（app.js 用 cmdk-body/hint/sec） ---- */
.cmdk-body { overflow-y: auto; padding: 8px; max-height: calc(70vh - 60px); }
.cmdk-hint { padding: 16px 12px; font-size: 12.5px; color: var(--text-3); text-align: center; }
.cmdk-sec {
  font-size: 10.5px; color: var(--text-3); font-weight: 700;
  letter-spacing: .6px; padding: 8px 10px 4px;
}
.cmdk-item .ic { display: flex; flex: 0 0 16px; color: var(--text-3); }
.cmdk-item > div { flex: 1; min-width: 0; }
.cmdk-item .t { font-size: 13px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-item .d { font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-item > svg { flex: 0 0 14px; color: var(--text-4); }

/* ---- 提醒抽屉（app.js 用 remind-sec/remind-item） ---- */
.remind-sec { padding: 6px 0 10px; }
.remind-sec h4 {
  font-size: 11px; font-weight: 700; color: var(--text-3); letter-spacing: .4px;
  margin: 0 0 4px; display: flex; align-items: center; gap: 6px;
  text-transform: none;
}
.remind-sec h4 .cnt {
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 20px;
  background: #f1f3f8; color: var(--text-2); min-width: 16px; text-align: center;
}
.remind-item {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 9px 0; border-bottom: 1px dashed #f1f3f8; cursor: pointer;
}
.remind-item:last-child { border-bottom: 0; }
.remind-item:hover .ri-title { color: var(--brand); }
.remind-item .ri-title { font-size: 12.5px; font-weight: 550; line-height: 1.45; }
.remind-item .ri-sub { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.remind-item > svg { flex: 0 0 14px; color: var(--text-4); margin-top: 3px; }
.dot-red, .dot-blue, .dot-amber, .dot-gray {
  width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; margin-top: 6px;
}
.dot-red { background: var(--danger); }
.dot-blue { background: var(--info); }
.dot-amber { background: var(--warning); }
.dot-gray { background: var(--text-4); }

/* ---- 用户切换弹窗 ---- */
.user-list { display: flex; flex-direction: column; gap: 2px; }
.user-list .user-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 9px; cursor: pointer;
  transition: background .14s;
}
.user-list .user-row:hover { background: #f5f6fb; }
.user-list .user-row.active { background: var(--brand-50); }

/* ---- 表单错误提示（forms.js 用 alert-box） ---- */
.alert-box {
  display: flex; gap: 9px; padding: 10px 13px; border-radius: 9px;
  font-size: 12.5px; line-height: 1.6; align-items: flex-start;
  background: var(--danger-50); border: 1px solid #fecaca; color: #991b1b;
}
/* hidden 属性必须能覆盖 .alert-box 的 display:flex，否则空错误条会一直占位 */
.alert-box[hidden] { display: none; }
.alert-box.amber, .alert-box.warn { background: var(--warning-50); border-color: #fde68a; color: #92400e; }
.alert-box.info { background: var(--info-50); border-color: #bae6fd; color: #075985; }
.alert-box svg { flex: 0 0 auto; margin-top: 1px; }

/* ---- 阶段徽标（page.js 用 stage-badge + --sc 变量） ---- */
.stage-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 20px; font-size: 11.5px; font-weight: 500;
  background: color-mix(in srgb, var(--sc, #64748b) 12%, #fff);
  color: var(--sc, #475569);
  border: 1px solid color-mix(in srgb, var(--sc, #64748b) 28%, #fff);
  white-space: nowrap;
}
.stage-badge i { width: 6px; height: 6px; border-radius: 50%; background: var(--sc, #64748b); flex: 0 0 6px; }

/* ---- 表格横向滚动容器 ---- */
.tbl-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---- 任务列表（tasks.js 用 task-item/task-detail） ---- */
.task-item { border-bottom: 1px solid var(--border); }
.task-item:last-child { border-bottom: 0; }
.task-item[data-status="done"] { opacity: .78; }
.task-item .list-item { border-bottom: 0; }
.task-detail {
  padding: 2px 20px 14px 56px;
  font-size: 12.5px; color: var(--text-2); line-height: 1.65;
  background: #fbfcfe;
}
.task-detail .kv { display: flex; gap: 8px; margin-top: 5px; }
.task-detail .kv b { color: var(--text-3); font-weight: 600; flex: 0 0 68px; }
.task-detail[hidden] { display: none; }

/* ---- 全局加载态 ---- */
.page-loading {
  display: flex; align-items: center; justify-content: center;
  min-height: 320px; color: var(--text-3); font-size: 13px;
}

/* ---- 快速新建菜单 ---- */
.quick-menu {
  position: fixed; z-index: 120; min-width: 176px; padding: 6px;
  background: #fff; border: 1px solid var(--border); border-radius: 11px;
  box-shadow: var(--shadow-lg); animation: slideUp .14s;
}
.quick-menu button {
  width: 100%; display: flex; align-items: center; gap: 9px;
  padding: 8px 11px; border: 0; border-radius: 7px; background: transparent;
  font-family: inherit; font-size: 13px; color: var(--text); cursor: pointer; text-align: left;
}
.quick-menu button:hover { background: #f5f6fb; color: var(--brand); }
.quick-menu button svg { flex: 0 0 16px; color: var(--text-3); }
.quick-menu button:hover svg { color: var(--brand); }

/* ---- 小号按钮 ---- */
.btn-xs { height: 24px; padding: 0 8px; font-size: 11.5px; border-radius: 6px; gap: 4px; }
.btn-xs svg { width: 12px; height: 12px; }

/* ---- 跟进动态筛选行（activities.js 用 f-q） ---- */
.f-q { min-width: 220px; }

/* ---- 侧栏折叠/窄屏适配（补 sb-* 版本） ---- */
@media (max-width: 1100px) {
  .sb-brand { justify-content: center; padding: 0; }
  .sb-brand .brand-text { display: none; }
  .sb-nav .nav-group { display: none; }
  .sb-nav .nav-item { justify-content: center; padding: 11px; }
  .sb-nav .nav-item .label, .sb-nav .nav-badge { display: none; }
  .sb-user { justify-content: center; padding: 6px; }
  .sb-user .uinfo { display: none; }
  .sb-user > svg { display: none; }
}
@media (max-width: 820px) {
  .tb-search { width: 38px; padding: 0; justify-content: center; }
  .tb-search span, .tb-search kbd { display: none; }
}

/* 移动端：菜单按钮唤出侧边抽屉（<820px 时侧栏默认隐藏） */
@media (max-width: 820px) {
  #app.mobile-nav-open .sidebar {
    display: flex; position: fixed; left: 0; top: 0; bottom: 0;
    width: 232px; flex: 0 0 232px; z-index: 60;
    box-shadow: 0 0 40px rgba(0, 0, 0, .35);
  }
  #app.mobile-nav-open .sidebar .brand-text,
  #app.mobile-nav-open .sidebar .nav-group,
  #app.mobile-nav-open .sidebar .nav-item .label,
  #app.mobile-nav-open .sidebar .nav-badge { display: block; }
  #app.mobile-nav-open .sidebar .sb-brand { justify-content: flex-start; padding: 0 18px; }
  #app.mobile-nav-open .sidebar .nav-item { justify-content: flex-start; padding: 9px 11px; }
  #app.mobile-nav-open .sidebar .sb-user { justify-content: flex-start; padding: 6px 8px; }
  #app.mobile-nav-open .sidebar .sb-user .uinfo { display: flex; }
}

/* ---------- 工具栏内控件宽度修正（select 默认 width:100% 会逐行占满） ---------- */
.toolbar .tb-left > .select,
.toolbar .tb-left > .select-sm,
.toolbar .tb-left > select { width: auto; min-width: 108px; max-width: 190px; flex: 0 0 auto; }
.toolbar .tb-left > .input,
.toolbar .tb-left > .input-sm { width: auto; }
.toolbar .search-box { flex: 0 0 240px; width: 240px; }
.toolbar .search-box .input { width: 100%; }
.toolbar .check { flex: 0 0 auto; white-space: nowrap; }
.toolbar .tb-right { flex: 0 0 auto; }

/* ============================================================
 * 登录页
 * ============================================================ */
#login-root[hidden] { display: none; }
#app[hidden] { display: none; }

.login-wrap {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 18px;
  padding: 32px 20px;
  background:
    radial-gradient(900px 500px at 12% 0%, rgba(79,70,229,.16), transparent 62%),
    radial-gradient(760px 460px at 92% 100%, rgba(14,165,233,.14), transparent 60%),
    linear-gradient(160deg, #0b1220 0%, #111827 46%, #0f172a 100%);
}

.login-card {
  width: 100%; max-width: 396px;
  background: #fff;
  border-radius: 18px;
  padding: 34px 32px 26px;
  box-shadow: 0 26px 70px -18px rgba(4, 8, 20, .55), 0 0 0 1px rgba(255,255,255,.06);
  animation: loginIn .32s ease-out both;
}
@keyframes loginIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 26px; }
.login-logo {
  width: 40px; height: 40px; border-radius: 11px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #6366f1, #4338ca);
  color: #fff; font-size: 19px; font-weight: 800;
  box-shadow: 0 6px 16px -4px rgba(79,70,229,.55);
}
.login-brand strong { display: block; font-size: 16px; letter-spacing: .2px; color: #0f172a; }
.login-brand span { display: block; font-size: 11.5px; color: #94a3b8; margin-top: 1px; }

.login-title { font-size: 22px; font-weight: 700; color: #0f172a; letter-spacing: -.3px; }
.login-sub { font-size: 12.5px; color: #94a3b8; margin: 6px 0 24px; line-height: 1.6; }

.login-form { display: flex; flex-direction: column; gap: 15px; }
.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-field > span { font-size: 12px; font-weight: 600; color: #475569; }
.login-field input {
  height: 42px; padding: 0 13px;
  border: 1px solid #e2e8f0; border-radius: 9px;
  font-size: 13.5px; color: #0f172a; font-family: inherit;
  background: #f8fafc;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.login-field input::placeholder { color: #a9b4c4; }
.login-field input:focus {
  outline: none; background: #fff;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,.16);
}
.login-error {
  font-size: 12px; color: #b91c1c;
  background: #fef2f2; border: 1px solid #fecaca;
  border-radius: 8px; padding: 8px 11px; line-height: 1.5;
}
.login-btn {
  height: 44px; margin-top: 4px;
  border: 0; border-radius: 9px; cursor: pointer;
  background: linear-gradient(145deg, #5b52ea, #4338ca);
  color: #fff; font-size: 14px; font-weight: 600; letter-spacing: 2px;
  font-family: inherit;
  box-shadow: 0 10px 22px -8px rgba(79,70,229,.7);
  transition: transform .12s, box-shadow .16s, opacity .16s;
}
.login-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 14px 26px -8px rgba(79,70,229,.75); }
.login-btn:active:not(:disabled) { transform: translateY(0); }
.login-btn:disabled { opacity: .62; cursor: default; }

.login-foot {
  margin-top: 22px; padding-top: 16px;
  border-top: 1px dashed #e8edf5;
  font-size: 11.5px; color: #94a3b8;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.login-foot b { color: #64748b; font-weight: 600; }
.login-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.15); flex: 0 0 auto;
}
.login-copy { font-size: 11.5px; color: rgba(226,232,240,.36); letter-spacing: .2px; }

@media (max-width: 480px) {
  .login-wrap { padding: 20px 14px; }
  .login-card { padding: 28px 22px 22px; border-radius: 15px; }
  .login-title { font-size: 20px; }
}
