/* ============ CRM 客户经营中心 · 设计系统 ============ */
:root {
  --bg: #f5f7fa;
  --bg-deep: #eef1f6;
  --card: #ffffff;
  --border: #e5e9f0;
  --border-strong: #d7dde7;

  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --primary-light: #eff4ff;
  --primary-ghost: #dbe7ff;

  --text-1: #1f2d3d;
  --text-2: #55657a;
  --text-3: #8494a8;
  --text-4: #aab6c5;

  --blue: #2563eb;   --blue-bg: #eff4ff;
  --green: #16a34a;  --green-bg: #e9f9ef;
  --orange: #f59e0b; --orange-bg: #fff7e8;
  --red: #dc2626;    --red-bg: #feecec;
  --gray: #6b7280;   --gray-bg: #f1f3f6;
  --purple: #7c3aed; --purple-bg: #f4efff;
  --cyan: #0891b2;   --cyan-bg: #e6f7fb;

  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 12px;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow-pop: 0 6px 24px rgba(16, 24, 40, .10), 0 2px 6px rgba(16, 24, 40, .06);
  --shadow-pop-lg: 0 12px 40px rgba(16, 24, 40, .16), 0 4px 12px rgba(16, 24, 40, .08);

  --sidebar-w: 216px;
  --sidebar-w-fold: 72px;
  --topbar-h: 56px;
  --font-num: "SF Pro Display", "Inter", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 13px; color: var(--text-1); background: var(--bg);
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 13px; color: var(--text-1); outline: none; }
a { text-decoration: none; color: inherit; }
svg { display: block; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #a9b8cc; }
::-webkit-scrollbar-track { background: transparent; }

/* ============ 布局 ============ */
.app-root { display: flex; height: 100vh; }
.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page-container { flex: 1; overflow-y: auto; padding: 16px 24px 40px; }
.page { max-width: 1560px; margin: 0 auto; animation: pageIn .22s ease; }
@keyframes pageIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ============ 骨架屏（Loading 状态） ============ */
.skel { background: var(--bg-deep); border-radius: 8px; }
.skel-head { width: 220px; height: 22px; margin-bottom: 8px; }
.skel-sub { width: 340px; height: 14px; margin-bottom: 20px; }
.skel-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 16px; }
.skel-stat { height: 92px; }
.skel-cards { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(330px, .8fr); gap: 16px; }
.skel-big { height: 400px; }
.skel-side-col { display: flex; flex-direction: column; gap: 16px; }
.skel-shimmer { position: relative; overflow: hidden; }
.skel-shimmer::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  animation: skelSlide 1.1s linear infinite;
}
@keyframes skelSlide { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@media (max-width: 1100px) { .skel-cards { grid-template-columns: 1fr; } .skel-side-col { display: grid; grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) { .skel-stats { grid-template-columns: 1fr 1fr; gap: 10px; }.skel-stat { height: 78px; }.skel-head { width: 60%; }.skel-sub { width: 85%; }.skel-side-col { grid-template-columns: 1fr; } }

/* ============ 侧边栏 ============ */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: #16202e;
  display: flex; flex-direction: column; position: relative; z-index: 30;
  transition: width .2s ease;
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; padding: 16px 14px 14px; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  display: flex; align-items: center; justify-content: center; color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, .35);
}
.logo-mark svg { width: 18px; height: 18px; }
.logo-text { overflow: hidden; white-space: nowrap; transition: opacity .15s; }
.logo-name { color: #fff; font-size: 14px; font-weight: 600; letter-spacing: .3px; }
.logo-sub { color: #6b7c93; font-size: 10px; margin-top: 2px; transform: scale(.92); transform-origin: left; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 10px; }
.sb-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px; border-radius: 8px; color: #aebccd; font-size: 13px;
  margin-bottom: 2px; transition: background .15s, color .15s; white-space: nowrap; text-align: left;
}
.sb-item:hover { background: rgba(255,255,255,.06); color: #e6edf5; }
.sb-item.active { background: var(--primary); color: #fff; box-shadow: 0 2px 10px rgba(37,99,235,.4); }
.sb-item.active .sb-icon { color: #fff; }
.sb-icon { width: 18px; height: 18px; flex-shrink: 0; display: flex; color: #77889d; transition: color .15s; }
.sb-item:hover .sb-icon { color: #b9c6d4; }
.sb-icon svg { width: 18px; height: 18px; }
.sb-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.sb-badge { margin-left: auto; background: var(--red); color: #fff; font-size: 10px; border-radius: 8px; padding: 1px 6px; font-weight: 600; }
/* 一级可展开项 */
.sb-parent { position: relative; }
.sb-arrow { margin-left: auto; display: flex; opacity: .5; transition: transform .15s, opacity .15s; }
.sb-parent.expanded .sb-arrow { transform: rotate(180deg); }
.sb-parent.active .sb-arrow { opacity: .85; }
/* 二级子项 */
.sb-child { padding: 7px 12px 7px 40px; font-size: 12.5px; color: #93a3b8; border-radius: 8px; }
.sb-child:hover { background: rgba(255,255,255,.06); color: #e6edf5; }
.sb-child.active { background: rgba(37,99,235,.22); color: #fff; box-shadow: none; font-weight: 500; }
.sidebar-bottom { border-top: 1px solid rgba(255,255,255,.07); padding: 8px 10px 10px; }
.sidebar-bottom .sb-item { color: #93a3b8; font-size: 13px; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 8px 8px 4px; white-space: nowrap; }
.sidebar-user-info { flex: 1; overflow: hidden; }
.sidebar-user-name { color: #e8eef6; font-size: 13px; font-weight: 500; }
.sidebar-user-role { color: #6b7c93; font-size: 11px; margin-top: 1px; }
.sidebar-user-more { color: #6b7c93; flex-shrink: 0; }
.sidebar-user-more svg { width: 16px; height: 16px; }

.app-root.folded .sidebar { width: var(--sidebar-w-fold); }
.app-root.folded .logo-text, .app-root.folded .sidebar-user-info,
.app-root.folded .sidebar-user-more, .app-root.folded .sb-badge, .app-root.folded .sb-arrow { display: none; }
.app-root.folded .sb-label { display: none; }
.app-root.folded .sb-child { display: none; }
.app-root.folded .sidebar-logo { justify-content: center; padding: 16px 0 14px; }
.app-root.folded .sb-item { justify-content: center; padding: 10px 0; }
.app-root.folded .sidebar-user { justify-content: center; padding: 10px 0 4px; }
.sidebar-collapse-btn {
  position: absolute; left: calc(var(--sidebar-w) - 13px); top: 14px; z-index: 31;
  width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; color: var(--text-3);
  box-shadow: var(--shadow-pop); transition: left .2s ease, transform .2s;
}
.app-root.folded .sidebar-collapse-btn { left: calc(var(--sidebar-w-fold) - 13px); }
.app-root.folded .sidebar-collapse-btn svg { transform: rotate(180deg); }
.sidebar-collapse-btn svg { width: 14px; height: 14px; transition: transform .2s; }
.sidebar-collapse-btn:hover { color: var(--primary); border-color: var(--primary-ghost); }

/* 侧边栏 Hover Tooltip（折叠态提示一级模块名，JS 动态创建 fixed 浮层） */
.sb-tooltip {
  position: fixed; z-index: 1200;
  transform: translateY(-50%) translateX(-4px);
  background: #16202e; color: #e6edf5; font-size: 12px;
  padding: 6px 11px; border-radius: 6px; white-space: nowrap;
  pointer-events: none; opacity: 0;
  transition: opacity .12s ease, transform .12s ease;
  box-shadow: 0 4px 14px rgba(15, 23, 42, .35);
}
.sb-tooltip.show { opacity: 1; transform: translateY(-50%) translateX(0); }

/* ============ 顶部栏 ============ */
.topbar {
  height: var(--topbar-h); background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 20px;
  flex-shrink: 0; position: relative; z-index: 20;
}
.topbar-left { display: flex; align-items: center; min-width: 0; }
.mobile-nav-btn { display:none; width:34px; height:34px; margin-right:8px; border-radius:8px; color:var(--text-2); align-items:center; justify-content:center; }
.mobile-nav-btn svg { width:18px; height:18px; }
.mobile-nav-mask { display:none; }
.breadcrumb { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 12.5px; white-space: nowrap; }
.breadcrumb .crumb-current { color: var(--text-1); font-weight: 500; }
.breadcrumb .crumb-sep { color: var(--text-4); }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.global-search { position: relative; display: flex; align-items: center; }
.global-search > svg { position: absolute; left: 11px; width: 15px; height: 15px; color: var(--text-3); pointer-events: none; }
.global-search input {
  width: 280px; height: 34px; border: 1px solid var(--border); border-radius: 8px;
  padding: 0 56px 0 34px; background: var(--bg); transition: all .15s;
}
.global-search input:focus { background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.10); width: 320px; }
.global-search kbd {
  position: absolute; right: 9px; font-size: 10px; color: var(--text-4);
  border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; background: #fff; font-family: inherit;
}
.global-search-panel {
  position: absolute; top: 40px; left: 0; width: 420px; background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-pop-lg);
  display: none; overflow: hidden;
}
.global-search-panel.open { display: block; animation: pageIn .15s ease; }
.gs-group-label { font-size: 11px; color: var(--text-4); padding: 10px 14px 4px; }
.gs-item { display: flex; align-items: center; gap: 10px; padding: 9px 14px; cursor: pointer; }
.gs-item:hover { background: var(--bg); }
.gs-item .gs-type { font-size: 10px; border: 1px solid var(--border); color: var(--text-3); border-radius: 4px; padding: 0 5px; flex-shrink: 0; }
.gs-item .gs-name { font-weight: 500; }
.gs-item .gs-meta { color: var(--text-3); font-size: 12px; margin-left: auto; flex-shrink: 0; }
.gs-empty { padding: 24px; text-align: center; color: var(--text-4); font-size: 12.5px; }

.topbar-btn {
  display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
  border-radius: 8px; border: 1px solid var(--border); background: #fff; color: var(--text-2);
  font-size: 13px; transition: all .15s;
}
.topbar-btn:hover { border-color: var(--primary-ghost); color: var(--primary); background: var(--primary-light); }
.topbar-btn svg { width: 15px; height: 15px; }
.topbar-btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 500; }
.topbar-btn-primary:hover { background: var(--primary-strong); color: #fff; }
.topbar-btn-arrow { display: flex; margin-left: 2px; }
.topbar-btn-arrow svg { width: 13px; height: 13px; }
.topbar-btn.icon-only { padding: 0; width: 34px; justify-content: center; position: relative; }
.badge-dot {
  position: absolute; top: -4px; right: -5px; min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--red); color: #fff; font-size: 10px; font-weight: 600; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; border: 2px solid #fff; font-style: normal;
}
.topbar-divider { width: 1px; height: 20px; background: var(--border); margin: 0 2px; }
.topbar-user { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 8px; cursor: pointer; }
.topbar-user:hover { background: var(--bg); }
.topbar-user span { font-size: 13px; color: var(--text-1); font-weight: 500; }

/* ============ 头像 ============ */
.avatar {
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 600; color: #fff; flex-shrink: 0; user-select: none;
}
.avatar-sm { width: 28px; height: 28px; font-size: 12px; }
.avatar-md { width: 34px; height: 34px; font-size: 13px; }
.avatar-lg { width: 44px; height: 44px; font-size: 16px; }
.avatar-blue { background: #3b82f6; }
.avatar-green { background: #10b981; }
.avatar-orange { background: #f59e0b; }
.avatar-purple { background: #8b5cf6; }
.avatar-cyan { background: #06b6d4; }
.avatar-gray { background: #94a3b8; }
.avatar-red { background: #ef4444; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { border: 2px solid #fff; margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; transition: all .15s;
  white-space: nowrap; border: 1px solid transparent;
}
.btn svg { width: 14px; height: 14px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-strong); }
.btn-ghost { background: #fff; border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover { border-color: var(--primary-ghost); color: var(--primary); background: var(--primary-light); }
.btn-plain { background: transparent; color: var(--text-2); }
.btn-plain:hover { background: var(--bg); color: var(--text-1); }
.btn-danger { background: #fff; border-color: #fecaca; color: var(--red); }
.btn-danger:hover { background: var(--red-bg); }
.btn-primary.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary.btn-danger:hover { background: #b91c1c; }
.btn-sm { height: 27px; padding: 0 10px; font-size: 12.5px; }
.btn-lg { height: 38px; padding: 0 18px; font-size: 14px; }
.btn-block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.icon-more { padding: 0 9px; }

/* ============ 徽章 / Tag ============ */
.tag {
  display: inline-flex; align-items: center; gap: 4px; height: 21px; padding: 0 8px;
  border-radius: 5px; font-size: 11.5px; font-weight: 500; white-space: nowrap;
}
.tag-dot { width: 5px; height: 5px; border-radius: 50%; }
.tag-blue { background: var(--blue-bg); color: var(--blue); }
.tag-blue .tag-dot { background: var(--blue); }
.tag-green { background: var(--green-bg); color: var(--green); }
.tag-green .tag-dot { background: var(--green); }
.tag-orange { background: var(--orange-bg); color: #c77700; }
.tag-orange .tag-dot { background: var(--orange); }
.tag-red { background: var(--red-bg); color: var(--red); }
.tag-red .tag-dot { background: var(--red); }
.tag-gray { background: var(--gray-bg); color: var(--gray); }
.tag-gray .tag-dot { background: var(--gray); }
.tag-purple { background: var(--purple-bg); color: var(--purple); }
.tag-purple .tag-dot { background: var(--purple); }
.tag-cyan { background: var(--cyan-bg); color: var(--cyan); }
.tag-cyan .tag-dot { background: var(--cyan); }
.tag-outline { background: #fff; border: 1px solid var(--border-strong); color: var(--text-2); }
.tag-lg { height: 25px; padding: 0 11px; font-size: 12.5px; }

.badge-num { display: inline-block; background: var(--bg); color: var(--text-2); border-radius: 8px; padding: 0 7px; font-size: 11px; height: 18px; line-height: 18px; font-weight: 500; }
.badge-num.hot { background: var(--red-bg); color: var(--red); }
.badge-num.blue { background: var(--blue-bg); color: var(--blue); }
.badge-num.green { background: var(--green-bg); color: var(--green); }

/* ============ 卡片 ============ */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card); overflow: hidden;
}
.card-pad { padding: 18px 20px; }
.card-header {
  display: flex; align-items: center; justify-content: space-between; padding: 15px 20px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 14.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-title .title-bar { width: 3px; height: 14px; background: var(--primary); border-radius: 2px; }
.card-title small { font-weight: 400; color: var(--text-3); font-size: 12px; }
.card-extra { display: flex; align-items: center; gap: 8px; }

/* ============ 页面头部 ============ */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.page-title { font-size: 18px; font-weight: 650; letter-spacing: .2px; }
.page-sub { color: var(--text-3); font-size: 12.5px; margin-top: 2px; }
.page-head-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ============ 数据卡片 ============ */
.stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 12px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px 16px; box-shadow: var(--shadow-card); transition: all .15s; }
.stat-card:hover { box-shadow: 0 4px 14px rgba(16,24,40,.07); border-color: var(--border-strong); }
.stat-click { cursor: pointer; }
.stat-click:active { transform: translateY(1px); }
.stat-label { color: var(--text-3); font-size: 12.5px; display: flex; align-items: center; gap: 5px; }
.stat-value { font-family: var(--font-num); font-size: 26px; font-weight: 700; margin-top: 5px; letter-spacing: -.3px; }
.stat-value.stat-value-lg { font-size: 28px; }
.stat-value .unit { font-size: 13px; font-weight: 500; color: var(--text-2); margin-left: 1px; }
.stat-trend { margin-top: 6px; font-size: 11.5px; color: var(--text-3); display: flex; align-items: center; gap: 4px; }
.stat-sub-note { font-size: 11.5px; color: var(--text-3); }
.stat-sub-note.warn { color: var(--orange); font-weight: 500; }
.trend-up { color: var(--green); }
.trend-down { color: var(--red); }
.trend-flat { color: var(--text-3); }
.trend-up svg, .trend-down svg { width: 11px; height: 11px; }

/* ============ 表格 ============ */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left; color: var(--text-3); font-weight: 500; font-size: 12px;
  padding: 11px 14px; background: #fafbfd; border-bottom: 1px solid var(--border);
  white-space: nowrap; user-select: none;
}
.data-table td { padding: 13px 14px; border-bottom: 1px solid #f0f3f8; vertical-align: middle; }
.data-table tbody tr { transition: background .12s; cursor: default; }
.data-table tbody tr:hover { background: #f7f9fc; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .row-check { width: 36px; text-align: center; }
.td-main { font-weight: 500; color: var(--text-1); }
.td-sub { color: var(--text-3); font-size: 12px; margin-top: 2px; }
.td-num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.link-text { color: var(--primary); cursor: pointer; font-weight: 500; }
.link-text:hover { text-decoration: underline; }
.td-actions { display: flex; gap: 4px; justify-content: flex-end; }
.td-actions .btn-sm { height: 26px; padding: 0 9px; }
.table-footer { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-top: 1px solid var(--border); }
.table-footer .total { color: var(--text-3); font-size: 12.5px; }
.pagination { display: flex; gap: 4px; }
.page-btn {
  min-width: 28px; height: 28px; padding: 0 6px; border: 1px solid var(--border); border-radius: 6px;
  display: flex; align-items: center; justify-content: center; color: var(--text-2); font-size: 12.5px; background: #fff;
}
.page-btn:hover { border-color: var(--primary-ghost); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btn svg { width: 13px; height: 13px; }

/* ============ 筛选区 ============ */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filter-item { position: relative; }
.f-input {
  height: 32px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff;
  padding: 0 30px 0 11px; font-size: 12.5px; color: var(--text-2); appearance: none; cursor: pointer;
  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='%238494a8' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; min-width: 96px;
}
.f-input:hover { border-color: var(--border-strong); }
.f-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.08); }
.f-input.f-search {
  padding-left: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238494a8' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-position: left 10px center; width: 210px;
}
.filter-bar .spacer { flex: 1; }
.filter-bar .btn { height: 32px; }

/* ============ 快捷筛选 chips ============ */
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
  height: 30px; padding: 0 13px; border-radius: 16px; border: 1px solid var(--border); background: #fff;
  color: var(--text-2); font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; transition: all .15s;
}
.chip:hover { border-color: var(--primary-ghost); color: var(--primary); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 500; }
.chip .chip-num { background: rgba(0,0,0,.06); border-radius: 8px; padding: 0 6px; font-size: 11px; }
.chip.active .chip-num { background: rgba(255,255,255,.22); }

/* ============ 时间轴 ============ */
.timeline { position: relative; padding-left: 4px; }
.tl-item { position: relative; padding: 0 0 20px 24px; }
.tl-item::before {
  content: ''; position: absolute; left: 5px; top: 16px; bottom: -2px; width: 2px; background: #e8edf4;
}
.tl-item:last-child::before { display: none; }
.tl-dot {
  position: absolute; left: 0; top: 3px; width: 12px; height: 12px; border-radius: 50%;
  border: 2.5px solid var(--primary); background: #fff;
}
.tl-dot.green { border-color: var(--green); }
.tl-dot.orange { border-color: var(--orange); }
.tl-dot.red { border-color: var(--red); }
.tl-dot.gray { border-color: #cbd5e1; }
.tl-dot.blue { border-color: var(--blue); }
.tl-dot.purple { border-color: var(--purple); }
.tl-dot.cyan { border-color: var(--cyan); }
.tl-item[data-dot="green"] .tl-dot { border-color: var(--green); }
.tl-item[data-dot="orange"] .tl-dot { border-color: var(--orange); }
.tl-item[data-dot="red"] .tl-dot { border-color: var(--red); }
.tl-item[data-dot="gray"] .tl-dot { border-color: #cbd5e1; }
.tl-item[data-dot="purple"] .tl-dot { border-color: var(--purple); }
.tl-item[data-dot="cyan"] .tl-dot { border-color: var(--cyan); }
.tl-time { font-size: 11.5px; color: var(--text-4); margin-bottom: 3px; font-family: var(--font-num); }
.tl-title { font-size: 13px; font-weight: 550; color: var(--text-1); line-height: 1.5; }
.tl-desc { font-size: 12.5px; color: var(--text-2); margin-top: 4px; line-height: 1.6; }
.tl-tags { display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.tl-link { font-size: 12px; color: var(--primary); cursor: pointer; margin-top: 7px; display: inline-flex; align-items: center; gap: 3px; }
.tl-link:hover { text-decoration: underline; }

/* ============ Modal ============ */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 100;
  display: flex; align-items: center; justify-content: center; animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff; border-radius: 14px; box-shadow: var(--shadow-pop-lg); width: 520px; max-width: calc(100vw - 48px);
  max-height: calc(100vh - 80px); display: flex; flex-direction: column; animation: modalIn .18s cubic-bezier(.2,.8,.3,1);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-lg { width: 680px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 0; }
.modal-title { font-size: 16px; font-weight: 650; }
.modal-close { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--text-3); }
.modal-close:hover { background: var(--bg); color: var(--text-1); }
.modal-close svg { width: 16px; height: 16px; }
.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 18px; }

/* ============ 表单 ============ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-item { display: flex; flex-direction: column; gap: 6px; }
.form-item label { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.form-item label .req { color: var(--red); margin-left: 2px; }
.form-control {
  height: 34px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 11px;
  background: #fff; transition: all .15s; width: 100%;
}
.form-control:hover { border-color: var(--border-strong); }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.09); }
textarea.form-control { height: auto; padding: 9px 11px; resize: vertical; line-height: 1.6; min-height: 74px; }
select.form-control { 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='%238494a8' stroke-width='2' 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: 30px; cursor: pointer; }
.form-tip { font-size: 11.5px; color: var(--text-4); }

/* ============ Drawer ============ */
.drawer-mask { position: fixed; inset: 0; background: rgba(15,23,42,.35); z-index: 90; animation: fadeIn .18s ease; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 560px; max-width: 92vw; background: #fff; z-index: 91;
  box-shadow: -8px 0 32px rgba(16,24,40,.14); display: flex; flex-direction: column; animation: drawerIn .22s cubic-bezier(.2,.8,.3,1);
}
@keyframes drawerIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-lg { width: 720px; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px 32px; }
.drawer-title { font-size: 16px; font-weight: 650; display: flex; align-items: center; gap: 10px; }

/* ============ Toast ============ */
.toast-root { position: fixed; top: 68px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 9px; background: #fff; border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow-pop-lg); padding: 10px 16px; font-size: 13px;
  animation: toastIn .25s cubic-bezier(.2,.8,.3,1); max-width: 420px;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }
.toast.out { animation: toastOut .2s ease forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px); } }
.toast-icon { width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.toast-icon svg { width: 11px; height: 11px; }
.toast-success .toast-icon { background: var(--green); color: #fff; }
.toast-error .toast-icon { background: var(--red); color: #fff; }
.toast-info .toast-icon { background: var(--blue); color: #fff; }
.toast-warn .toast-icon { background: var(--orange); color: #fff; }
.toast-link { color: var(--primary); cursor: pointer; font-weight: 500; margin-left: 6px; }
.toast-link:hover { text-decoration: underline; }

/* ============ 下拉菜单 ============ */
.dropdown-panel {
  position: absolute; background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-pop-lg); min-width: 180px; padding: 6px; display: none; z-index: 80;
}
.dropdown-panel.open { display: block; animation: pageIn .14s ease; }
.dd-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--text-1); }
.dd-item:hover { background: var(--bg); }
.dd-item svg { width: 15px; height: 15px; color: var(--text-3); }
.dd-item .dd-desc { font-size: 11.5px; color: var(--text-4); margin-left: auto; }
.dd-sep { height: 1px; background: var(--border); margin: 5px 8px; }
.dd-title { font-size: 11px; color: var(--text-4); padding: 6px 10px 2px; }

/* ============ 进度条 ============ */
.progress { height: 6px; background: var(--bg-deep); border-radius: 4px; overflow: hidden; }
.progress .progress-in { height: 100%; border-radius: 4px; background: var(--primary); transition: width .3s; }
.progress-in.green { background: var(--green); }
.progress-in.orange { background: var(--orange); }
.progress-in.red { background: var(--red); }
.progress-in.gray { background: var(--gray); }

/* ============ 通用工具 ============ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.grow { flex: 1; } .minw0 { min-width: 0; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-20 { margin-bottom: 20px; }
.text-1 { color: var(--text-1); } .text-2 { color: var(--text-2); } .text-3 { color: var(--text-3); } .text-4 { color: var(--text-4); }
.fs-12 { font-size: 12px; } .fs-11 { font-size: 11px; } .fs-14 { font-size: 14px; } .fs-16 { font-size: 16px; }
.fw-500 { font-weight: 500; } .fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.clickable { cursor: pointer; }
.hoverable { transition: all .15s; }
.empty-state { padding: 48px 20px; text-align: center; color: var(--text-4); font-size: 13px; }
.empty-state svg { width: 40px; height: 40px; margin: 0 auto 12px; color: #d3dbe6; }

/* ============ Action Sheet（底部弹出面板） ============ */
.action-sheet-mask {
  position: fixed; inset: 0; z-index: 70; background: rgba(15,23,42,.42);
  display: flex; align-items: flex-end;
}
.action-sheet {
  width: 100%; max-height: 74vh; overflow-y: auto; background: #fff;
  border-radius: 14px 14px 0 0; padding-bottom: env(safe-area-inset-bottom);
  animation: sheetUp .22s ease;
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: .5; } to { transform: none; opacity: 1; } }
.as-title { padding: 14px 18px 4px; font-size: 12px; color: var(--text-3); }
.as-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 13px 18px; font-size: 14px; color: var(--text-1); text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.as-item svg { width: 18px; height: 18px; color: var(--text-3); flex-shrink: 0; }
.as-item:active { background: var(--bg); }
.as-cancel {
  display: flex; align-items: center; justify-content: center; width: 100%;
  padding: 15px; font-size: 15px; color: var(--text-2); border-top: 6px solid var(--bg);
  -webkit-tap-highlight-color: transparent;
}
.as-cancel:active { background: var(--bg); }

/* ============ 移动端：底部导航 + 轻量顶部栏 ============ */
.mobile-bottom-nav, .mobile-topbar-title, .mobile-search-layer, #mobileSearchBtn, .mobile-back { display: none; }

@media (max-width: 760px) {
  body { overflow: hidden; }
  /* 侧边栏在移动端完全隐藏（由底部导航取代） */
  .sidebar, .sidebar-collapse-btn { display: none; }
  .page-container { padding: 14px 16px 96px; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

  /* 顶部栏：标题 + 搜索/新增/通知 */
  .topbar { height: 52px; padding: 0 16px; }
  .topbar-left { min-width: 0; }
  .mobile-topbar-title {
    display: block; font-size: 15px; font-weight: 600; color: var(--text-1);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw;
  }
  .mobile-back {
    flex-shrink: 0; width: 36px; height: 36px; margin-left: -8px;
    align-items: center; justify-content: center; color: var(--text-1); border-radius: 8px;
  }
  .mobile-back svg { width: 20px; height: 20px; }
  .mobile-back:active { background: var(--bg); }
  .mobile-back.show { display: flex; }
  .breadcrumb { display: none; }
  .topbar-right { gap: 4px; }
  .global-search, .topbar-divider, .topbar-user, #btnTodo { display: none; }
  #mobileSearchBtn { display: flex; }
  #btnQuickCreate { width: 36px; height: 36px; padding: 0; justify-content: center; font-size: 0; }
  #btnQuickCreate > svg { width: 17px; height: 17px; }
  #btnQuickCreate .topbar-btn-arrow { display: none; }
  #btnNotice { width: 36px; height: 36px; }

  /* 底部导航 */
  .mobile-bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: #fff; border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .mbn-item {
    flex: 1; min-height: 56px; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 3px; color: var(--text-3); font-size: 10.5px;
    -webkit-tap-highlight-color: transparent;
  }
  .mbn-icon { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; }
  .mbn-icon svg { width: 21px; height: 21px; }
  .mbn-item:active { opacity: .65; }
  .mbn-item.active { color: var(--primary); font-weight: 600; }

  /* 移动端全屏搜索层 */
  .mobile-search-layer {
    display: none; position: fixed; inset: 0; z-index: 60; background: var(--bg);
    padding: 12px 16px calc(24px + env(safe-area-inset-bottom));
  }
  .mobile-search-layer.open { display: block; animation: pageIn .18s ease; }
  .msl-head { display: flex; align-items: center; gap: 10px; }
  .msl-input-wrap { flex: 1; position: relative; min-width: 0; }
  .msl-input-wrap > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-3); pointer-events: none; }
  .msl-input-wrap input {
    width: 100%; height: 42px; background: #fff; border: 1px solid var(--border);
    border-radius: 10px; padding: 0 12px 0 36px; font-size: 14px;
  }
  .msl-input-wrap input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.10); }
  .msl-cancel { font-size: 14px; color: var(--text-2); padding: 8px 4px; flex-shrink: 0; }
  .msl-body { margin-top: 14px; background: #fff; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-card); }

  /* 页面头部与卡片 */
  .page-head { flex-direction: column; gap: 12px; margin-bottom: 14px; }
  .page-title { font-size: 18px; }
  .page-sub { font-size: 12px; line-height: 1.45; }
  .page-head-actions { width: 100%; overflow-x: auto; padding-bottom: 1px; }
  .page-head-actions .btn { white-space: nowrap; flex-shrink: 0; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-bottom: 12px; }
  .stat-grid .stat-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .stat-card { padding: 13px; border-radius: 10px; }
  .stat-value { font-size: 22px; margin-top: 5px; }
  .stat-trend { margin-top: 5px; }
  .card { border-radius: 10px; }
  .card-header { padding: 13px 14px; }
  .card-title { font-size: 14px; }
  .card-pad { padding: 14px; }
  .card-extra { max-width: 52%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .chip-row { flex-wrap: nowrap; overflow-x: auto; margin: 0 -12px 12px; padding: 0 12px 2px; }
  .chip { flex-shrink: 0; }
  .filter-bar { gap: 8px; }
  .filter-bar .f-search { width: 100%; }
  .filter-bar .f-input:not(.f-search) { flex: 1; min-width: calc(50% - 4px); }
  .filter-bar .spacer, .filter-bar .spacer + .fs-12 { display: none; }
  .table-wrap { margin: 0; }
  table.data-table { min-width: 760px; font-size: 12.5px; }
  .data-table th, .data-table td { padding: 11px 12px; }
  .table-footer { padding: 12px 14px; }
  .table-footer .total { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .form-grid { grid-template-columns: 1fr; gap: 12px; }
  .modal { width: calc(100vw - 24px); max-width: none; max-height: calc(100dvh - 28px); border-radius: 12px; }
  .modal-head { padding: 16px 16px 0; }.modal-body { padding: 16px; }.modal-foot { padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); }
  .drawer { max-width: 100vw; width: 100vw; }.drawer-head { padding: 16px; }.drawer-body { padding: 16px 16px 28px; }
  .toast-root { top: auto; bottom: calc(72px + env(safe-area-inset-bottom)); width: calc(100vw - 24px); }
  .toast { width: 100%; max-width: none; padding: 10px 12px; }
}
