/* ==========================================================================
   components.css —— 卡片 / 按钮 / 表格 / 标签 / 进度条 / 弹层 / toast /
   分页 / 空态 / 骨架屏 / 指标卡 / 图表（纯 CSS + 内联 SVG）
   ========================================================================== */

/* ----------------------------- 卡片 ----------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}
/* 悬浮微抬升：表格卡与列表行卡不参与（避免与行 hover 冲突） */
@supports selector(:has(*)) {
  .card:not(:has(.table)):not(.todo-card):hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
}
/* 工作台待办行卡：高亮描边而非抬升 */
.todo-card { background: var(--surface); }
.todo-card:hover { border-color: var(--brand); background: var(--brand-weak-2); }
.card-hd { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-hd h3 { display: flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 600; }
/* 卡片标题左侧 3px 品牌竖条（UI 精修 P2-10） */
.card-hd h3::before { content: ""; width: 3px; height: 14px; border-radius: 2px; background: linear-gradient(180deg, var(--brand), var(--brand-strong)); }
.card-hd .card-hd-sub { font-size: 12px; color: var(--text-3); }
.card-bd { padding: 18px; }
.card-bd.tight { padding: 0; }
.card-ft { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ----------------------------- 按钮 ----------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px; cursor: pointer; white-space: nowrap;
  transition: all 150ms ease;
  user-select: none;
}
.btn:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(22,119,255,.24); }
.btn-primary:hover { background: #3a8bff; border-color: #3a8bff; color: #fff; }
.btn-primary:active { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn-danger { background: var(--up); border-color: var(--up); color: #fff; }
.btn-danger:hover { background: #ec6270; border-color: #ec6270; color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-xs { height: 24px; padding: 0 8px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; }
.btn-link { background: none; border: none; color: var(--brand); cursor: pointer; padding: 0; height: auto; }
.btn-link:hover { text-decoration: underline; transform: none; box-shadow: none; }
.btn-group { display: inline-flex; gap: 8px; }
.btn-loading { pointer-events: none; opacity: .7; }

/* ----------------------------- 表单 ----------------------------- */
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.field .req::after { content: " *"; color: var(--up); }
.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); transition: all 150ms ease; outline: none;
}
.textarea { height: auto; min-height: 84px; padding: 9px 12px; resize: vertical; line-height: 1.6; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-weak); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.select { appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2.5 4.5L6 8l3.5-3.5' fill='none' stroke='%238f959e' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center; }
.input-sm, .select-sm { height: 32px; font-size: 13px; }
.form-error { color: var(--up); font-size: 12.5px; margin-top: 6px; min-height: 18px; }
.input-group { display: flex; }
.input-group .input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; height: 36px; }

/* 过滤条 */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filter-bar .input, .filter-bar .select { width: auto; min-width: 150px; }
.filter-bar .search-input { min-width: 240px; }
.filter-label { font-size: 12.5px; color: var(--text-3); margin-right: -4px; }

/* radio 组 */
.radio-row { display: flex; gap: 16px; align-items: center; }
.radio { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13.5px; }
.radio input { accent-color: var(--brand); width: 15px; height: 15px; }

/* ----------------------------- 表格（UI 精修 P1-6） ----------------------------- */
.table-wrap { overflow-x: auto; }
.table { font-size: 13.5px; }
.table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2);
  text-align: left; font-weight: 500; color: var(--text-3);
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  white-space: nowrap; font-size: 12px; letter-spacing: .2px;
}
.table tbody td { padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; height: 44px; }
.table tbody tr { transition: background 120ms ease; }
.table tbody tr:hover { background: var(--brand-weak-2); }
.table.striped tbody tr:nth-child(even) { background: var(--surface-2); }
.table.striped tbody tr:nth-child(even):hover { background: var(--brand-weak-2); }
.table td.num, .table th.num { font-variant-numeric: tabular-nums; }
/* 可排序表头（需求2：套餐档位正序/倒序） */
.th-sort {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: 0; padding: 0; margin: 0;
  font: inherit; font-size: 12px; letter-spacing: .2px;
  color: inherit; cursor: pointer; border-radius: 4px;
  transition: color 120ms ease;
}
.th-sort:hover { color: var(--brand); }
.th-sort:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.th-sort.active { color: var(--brand); font-weight: 600; }
.th-sort .ico { opacity: .45; transition: opacity 120ms ease; }
.th-sort:hover .ico { opacity: .85; }
.th-sort.active .ico { opacity: 1; }
.table .row-actions { display: flex; gap: 8px; white-space: nowrap; }
.table .cell-strong { font-weight: 600; }
.table .clickable { cursor: pointer; }
.table-empty { padding: 48px 12px; text-align: center; color: var(--text-3); }

/* 首列身份 chip：28×28 圆角 + 品牌浅底 */
.lead { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.lead-chip {
  width: 28px; height: 28px; border-radius: 9px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-weak); color: var(--brand);
  font-size: 11px; font-weight: 600; letter-spacing: .2px;
  font-variant-numeric: tabular-nums;
}
.lead-main { min-width: 0; line-height: 1.25; }
.lead-main .lead-main-t { font-weight: 500; }
.lead-main .lead-sub { font-size: 11.5px; color: var(--text-3); }

/* ----------------------------- 标签 / 徽标（统一 22px 胶囊） ----------------------------- */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; line-height: 1; white-space: nowrap;
  background: var(--bg); color: var(--text-2); border: 1px solid transparent;
}
.tag-blue { background: var(--brand-weak); color: var(--brand); }
.tag-up { background: var(--up-weak); color: var(--up); }
.tag-down { background: var(--down-weak); color: var(--down); }
.tag-warn { background: var(--warn-weak); color: var(--warn); }
.tag-gray { background: var(--bg); color: var(--text-2); }
.tag-line { background: transparent; border-color: var(--border); color: var(--text-2); }
.tag-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* 风险等级徽标：高=红 中=橙 低=绿 */
.risk { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.risk::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.risk-high { color: var(--up); background: var(--up-weak); } .risk-high::before { background: var(--up); }
.risk-mid { color: var(--warn); background: var(--warn-weak); } .risk-mid::before { background: var(--warn); }
.risk-low { color: var(--down); background: var(--down-weak); } .risk-low::before { background: var(--down); }

/* 状态点 */
.status { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; background: var(--bg); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.status-pending::before { background: var(--brand); }
.status-following::before { background: var(--warn); }
.status-done::before { background: var(--down); }
.status-expired::before { background: var(--up); }
.status-transferred::before { background: #8f959e; }

/* ----------------------------- 指标卡（UI 精修 P0-3） ----------------------------- */
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(188px, 1fr)); gap: 14px; }
.metric {
  display: flex; flex-direction: column; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px; position: relative; overflow: hidden;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}
.metric:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
/* 28px 圆角浅色图标芯片 */
.metric .m-ico {
  width: 28px; height: 28px; border-radius: 9px; margin-bottom: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--brand); background: var(--brand-weak);
}
.metric .m-ico .ico { display: block; }
.metric .m-label { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.metric .m-value {
  font-size: 30px; font-weight: 600; line-height: 1.15; margin-top: 4px;
  font-variant-numeric: tabular-nums; letter-spacing: -.5px;
}
.metric .m-value .m-unit { font-size: 12px; font-weight: 500; color: var(--text-3); margin-left: 4px; }
.metric .m-foot { font-size: 12px; color: var(--text-3); margin-top: 6px; }
/* 环比 delta：涨=红 ↑ / 跌=绿 ↓（中式金融配色） */
.metric .m-delta { font-size: 12px; font-weight: 500; margin-top: 8px; display: inline-flex; align-items: center; gap: 3px; color: var(--text-3); }
.metric .m-delta.up { color: var(--up); }
.metric .m-delta.down { color: var(--down); }
/* 左侧语义强调条 */
.metric .m-accent { position: absolute; top: 0; left: 0; width: 3px; height: 100%; background: var(--brand); }
.metric.acc-up .m-accent { background: var(--up); }
.metric.acc-up .m-ico { color: var(--up); background: var(--up-weak); }
.metric.acc-down .m-accent { background: var(--down); }
.metric.acc-down .m-ico { color: var(--down); background: var(--down-weak); }
.metric.acc-warn .m-accent { background: var(--warn); }
.metric.acc-warn .m-ico { color: var(--warn); background: var(--warn-weak); }
.metric.acc-brand .m-accent { background: var(--brand); }
.metric.acc-brand .m-ico { color: var(--brand); background: var(--brand-weak); }

/* ----------------------------- 进度条 / 图表（UI 精修 P0-4） ----------------------------- */
.bar { height: 8px; border-radius: 999px; background: #eef1f6; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), var(--brand-strong)); transition: width 600ms cubic-bezier(.2, .8, .2, 1); }
.bar.bar-up > span { background: linear-gradient(90deg, #f0717c, var(--up)); }
.bar.bar-down > span { background: linear-gradient(90deg, #33c48f, var(--down)); }
.bar.bar-warn > span { background: linear-gradient(90deg, #f5a35f, var(--warn)); }
.bar-lg { height: 10px; }
.bar-slim { height: 6px; }

/* 横向 CSS 柱状图（看板任务类型分布，零依赖） */
.hbar-row { display: grid; grid-template-columns: 96px 1fr 68px; align-items: center; gap: 12px; padding: 7px 0; cursor: pointer; border-radius: 8px; transition: background 120ms ease; }
.hbar-row:hover { background: var(--brand-weak-2); }
.hbar-label { font-size: 12.5px; color: var(--text-2); text-align: right; }
.hbar-track { height: 20px; background: #eef1f6; border-radius: 999px; overflow: hidden; position: relative; }
.hbar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), var(--brand-strong)); min-width: 3px; transition: width 600ms cubic-bezier(.2, .8, .2, 1); display: flex; align-items: center; }
.hbar-value { font-size: 12.5px; color: var(--text); font-variant-numeric: tabular-nums; text-align: right; }

/* 排行列表（看板 TOP10，进度条 + 名次） */
.rank-list { }
.rank-item { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 12px; padding: 9px 8px; border-bottom: 1px dashed var(--border); cursor: pointer; border-radius: 8px; }
.rank-item:last-child { border-bottom: none; }
.rank-item:hover { background: var(--brand-weak-2); }
.rank-no { width: 24px; height: 24px; border-radius: 8px; background: var(--bg); color: var(--text-2); font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.rank-no.top1 { background: linear-gradient(135deg, #ffd76a, #f5a623); color: #fff; box-shadow: 0 2px 6px rgba(245, 166, 35, .35); }
.rank-no.top2 { background: linear-gradient(135deg, #d8dee8, #b6bec9); color: #fff; box-shadow: 0 2px 6px rgba(182, 190, 201, .35); }
.rank-no.top3 { background: linear-gradient(135deg, #f0c49a, #d99a63); color: #fff; box-shadow: 0 2px 6px rgba(217, 154, 99, .32); }
.rank-main { min-width: 0; }
.rank-name { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.rank-name b { font-weight: 600; }
.rank-name .rank-team { font-size: 11px; color: var(--text-3); }
.rank-main .bar { margin-top: 6px; }
.rank-rate { font-size: 13px; font-weight: 600; color: var(--brand); font-variant-numeric: tabular-nums; }

/* ----------------------------- 预警清单 ----------------------------- */
.alert-list { display: flex; flex-direction: column; }
.alert-item { display: flex; gap: 10px; padding: 11px 0; border-bottom: 1px dashed var(--border); }
.alert-item:last-child { border-bottom: none; }
.alert-ico { width: 30px; height: 30px; border-radius: 9px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; font-size: 15px; }
.alert-ico.high { background: var(--up-weak); color: var(--up); }
.alert-ico.mid { background: var(--warn-weak); color: var(--warn); }
.alert-ico.low { background: var(--down-weak); color: var(--down); }
.alert-body { min-width: 0; flex: 1; }
.alert-body .a-title { font-size: 13px; font-weight: 500; }
.alert-body .a-desc { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* 骨架屏 */
.skeleton { background: linear-gradient(90deg, #eef1f5 25%, #f6f8fb 37%, #eef1f5 63%); background-size: 400% 100%; animation: sk 1.4s ease infinite; border-radius: 6px; }
.skeleton-text { height: 12px; margin: 8px 0; }
.skeleton-line-w60 { width: 60%; } .skeleton-line-w80 { width: 80%; } .skeleton-line-w40 { width: 40%; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ----------------------------- 空态 / 加载 / 错误（UI 精修 P2-9） ----------------------------- */
.state-box { padding: 52px 20px; text-align: center; }
.state-box .state-figure { display: flex; justify-content: center; margin-bottom: 14px; }
.state-box .state-ico {
  width: 64px; height: 64px; border-radius: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-weak-2); color: var(--brand);
}
.state-box .state-ico .ico { display: block; }
.state-box-error .state-ico { background: var(--up-weak); color: var(--up); }
.state-box .state-title { font-size: 14px; color: var(--text-2); font-weight: 600; }
.state-box .state-desc { font-size: 12.5px; color: var(--text-3); margin-top: 6px; }
.state-box .state-actions { margin-top: 16px; }
.spinner { width: 22px; height: 22px; border: 2.5px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-inline { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px; color: var(--text-3); font-size: 13px; }

/* 错误提示条（可重试） */
.alert-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; }
.alert-bar-error { background: var(--up-weak); color: #b33; border: 1px solid #f7c7cc; }
.alert-bar-warn { background: var(--warn-weak); color: #a35a12; border: 1px solid #f5d8b8; }
.alert-bar-info { background: var(--brand-weak); color: var(--brand); border: 1px solid #c3dbff; }
.alert-bar .ab-grow { flex: 1 1 auto; }

/* ----------------------------- 分页器（自绘） ----------------------------- */
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 6px; padding: 14px 18px; flex-wrap: wrap; }
.pager .pg-info { margin-right: auto; font-size: 12.5px; color: var(--text-3); }
.pager .pg-btn {
  flex: 0 0 auto;
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  cursor: pointer; font-size: 13px; transition: all 150ms ease; font-variant-numeric: tabular-nums;
}
.pager .pg-btn:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.pager .pg-btn:disabled { opacity: .45; cursor: not-allowed; }
.pager .pg-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }
/* 尺寸选择器：覆盖 .select{width:100%}，避免撑满整行导致换行 */
.pager .pg-size { flex: 0 0 auto; width: auto; height: 30px; font-size: 13px; min-width: 88px; }

/* ----------------------------- toast ----------------------------- */
.toast-root { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; }
.toast {
  min-width: 220px; max-width: 460px;
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; border-radius: var(--radius-sm);
  background: var(--surface); box-shadow: var(--shadow-pop);
  border: 1px solid var(--border);
  font-size: 13.5px; pointer-events: auto;
  animation: toast-in 220ms cubic-bezier(.2, .9, .3, 1.2);
}
.toast.leaving { animation: toast-out 200ms ease forwards; }
.toast .t-ico { width: 18px; height: 18px; border-radius: 50%; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; }
.toast .t-ico .ico { display: block; }
.toast-success .t-ico { background: var(--down); }
.toast-error .t-ico { background: var(--up); }
.toast-warn .t-ico { background: var(--warn); }
.toast-info .t-ico { background: var(--brand); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px) scale(.97); } }

/* ----------------------------- modal 弹层 ----------------------------- */
.modal-root:empty { display: none; }
.modal-mask {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(31, 35, 41, .38);
  backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 60px 16px 40px; overflow-y: auto;
  animation: mask-in 180ms ease;
}
@keyframes mask-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 520px; max-width: 100%;
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop); border: 1px solid var(--border);
  animation: modal-in 220ms cubic-bezier(.2, .9, .3, 1.1);
  overflow: hidden;
}
.modal.modal-lg { width: 720px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-hd { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 0; }
.modal-hd h3 { font-size: 16px; font-weight: 600; }
.modal-hd .modal-sub { font-size: 12.5px; color: var(--text-3); margin-top: 4px; }
.modal-close { border: none; background: none; font-size: 20px; line-height: 1; color: var(--text-3); cursor: pointer; padding: 4px 8px; border-radius: 8px; transition: all 150ms ease; }
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-bd { padding: 18px 22px; }
.modal-ft { padding: 0 22px 20px; display: flex; justify-content: flex-end; gap: 10px; }

/* ----------------------------- 画像详情 ----------------------------- */
.detail-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.phone-big { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: .3px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.kv-list { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; align-items: center; }
.kv-list dt { color: var(--text-3); font-size: 12.5px; white-space: nowrap; }
.kv-list dd { margin: 0; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.script-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 10px; background: var(--surface-2); transition: all 150ms ease; }
.script-item:hover { border-color: var(--brand); background: var(--brand-weak-2); }
.script-item .si-hd { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.script-item .si-body { font-size: 13.5px; line-height: 1.7; color: var(--text); }
.flow-line { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.flow-line .fl-label { font-size: 12.5px; color: var(--text-3); flex: 0 0 68px; }

/* ----------------------------- 代码块（工单内容） ----------------------------- */
.code-block { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }

/* ----------------------------- 描述列表 ----------------------------- */
.desc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 20px; }
.desc-item { display: flex; flex-direction: column; gap: 4px; }
.desc-item .di-k { font-size: 12px; color: var(--text-3); }
.desc-item .di-v { font-size: 13.5px; font-variant-numeric: tabular-nums; }

/* 规则 JSON 只读展示 */
.json-view { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; color: var(--text-2); }

/* 小标题分隔 */
.section-sub { font-size: 13px; font-weight: 600; color: var(--text-2); margin: 18px 0 10px; display: flex; align-items: center; gap: 8px; }
.section-sub::before { content: ""; width: 3px; height: 13px; background: var(--brand); border-radius: 2px; }

/* 请求中禁用遮罩 */
.busy-mask { position: absolute; inset: 0; background: rgba(255,255,255,.6); display: flex; align-items: center; justify-content: center; border-radius: var(--radius); z-index: 5; }

/* ----------------------------- 用户下拉菜单 ----------------------------- */
.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: 240px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden;
  animation: modal-in 160ms ease; z-index: 40;
}
.user-menu .um-hd { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.user-menu .um-name { font-size: 14px; font-weight: 600; }
.user-menu .um-sub { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.user-menu .um-item { display: block; width: 100%; text-align: left; padding: 10px 16px; border: none; background: none; cursor: pointer; font-size: 13.5px; color: var(--text); transition: background 120ms ease; }
.user-menu .um-item:hover { background: var(--bg); }
.user-menu .um-danger { color: var(--up); }

/* ==========================================================================
   改版 2026-10-07 —— 分段标签切换 / 零依赖图表 / 表格比率条 / 勾选网格 / 权重行
   ========================================================================== */

/* ----------------------------- 分段标签（时间范围 / TOP 榜） ----------------------------- */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; }
.seg .seg-btn {
  height: 26px; padding: 0 12px; border: none; background: transparent; border-radius: 7px;
  font-size: 12.5px; color: var(--text-2); cursor: pointer; transition: all 150ms ease; white-space: nowrap;
}
.seg .seg-btn:hover { color: var(--brand); }
.seg .seg-btn.active { background: var(--surface); color: var(--brand); font-weight: 600; box-shadow: var(--shadow); }
.seg .seg-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

/* ----------------------------- 甜甜圈饼图（conic-gradient，零依赖） ----------------------------- */
.pie-wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.pie { width: 148px; height: 148px; border-radius: 50%; flex: 0 0 auto; position: relative; }
.pie::after { content: ""; position: absolute; inset: 27px; background: var(--surface); border-radius: 50%; }
.pie-center { position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.pie-center b { font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.pie-center span { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.legend { flex: 1 1 210px; min-width: 0; }
.legend-row { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 12.5px; }
.legend-row:last-child { border-bottom: none; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; }
.legend-val { font-weight: 600; font-variant-numeric: tabular-nums; }
.legend-pct { color: var(--text-3); font-size: 11.5px; margin-left: 6px; font-variant-numeric: tabular-nums; }

/* ----------------------------- 纵向柱状图（CSS 高度条，零依赖） ----------------------------- */
.vbars { display: flex; align-items: flex-end; gap: 12px; height: 196px; padding-top: 10px; }
.vbar-col { flex: 1 1 0; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; }
.vbar-val { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.vbar { width: 100%; max-width: 40px; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, #5aa2ff, var(--brand)); min-height: 3px; transition: height 600ms cubic-bezier(.2, .8, .2, 1); }
.vbar-name { font-size: 11.5px; color: var(--text-3); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ----------------------------- 表格内嵌比率进度条 ----------------------------- */
.cell-pct { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.cell-pct .bar { width: 40px; height: 6px; flex: 0 0 auto; }
.cell-pct .cp-v { min-width: 46px; text-align: right; font-variant-numeric: tabular-nums; }
.delta-up { color: var(--up); font-variant-numeric: tabular-nums; }
.delta-down { color: var(--down); font-variant-numeric: tabular-nums; }

/* ----------------------------- 勾选网格（派单用户标签过滤） ----------------------------- */
.check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(212px, 1fr)); gap: 10px; }
.check-item { display: flex; align-items: flex-start; gap: 9px; padding: 11px 13px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; transition: all 150ms ease; }
.check-item:hover { border-color: var(--brand); background: var(--brand-weak-2); }
.check-item input { accent-color: var(--brand); width: 15px; height: 15px; margin: 2px 0 0; flex: 0 0 auto; }
.check-item .ci-t { font-size: 13px; font-weight: 500; }
.check-item .ci-d { font-size: 11.5px; color: var(--text-3); margin-top: 3px; line-height: 1.5; }

/* ----------------------------- 打分权重行 ----------------------------- */
.w-row { display: grid; grid-template-columns: 148px 1fr 96px; gap: 14px; align-items: center; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.w-row:last-child { border-bottom: none; }
.w-name { font-size: 13px; font-weight: 500; }
.w-name code { display: block; font-family: var(--mono); font-size: 11px; color: var(--text-3); margin-top: 2px; }
.w-row input[type="range"] { width: 100%; accent-color: var(--brand); height: 20px; }
.w-num { display: flex; align-items: center; gap: 6px; }
.w-num .input { width: 72px; height: 30px; text-align: right; padding: 0 8px; }
.w-num .unit { white-space: nowrap; }

/* ----------------------------- TOP5 卡片栏 ----------------------------- */
.top5 { display: grid; grid-template-columns: repeat(auto-fit, minmax(214px, 1fr)); gap: 12px; }
.top5-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); transition: all 150ms ease; cursor: pointer; }
.top5-card:hover { border-color: var(--brand); transform: translateY(-1px); box-shadow: var(--shadow); }
.top5-no { width: 30px; height: 30px; border-radius: 10px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; background: var(--bg); color: var(--text-2); font-variant-numeric: tabular-nums; }
.top5-no.top1 { background: linear-gradient(135deg, #ffd76a, #f5a623); color: #fff; }
.top5-no.top2 { background: linear-gradient(135deg, #d8dee8, #b6bec9); color: #fff; }
.top5-no.top3 { background: linear-gradient(135deg, #f0c49a, #d99a63); color: #fff; }
.top5-main { min-width: 0; flex: 1 1 auto; }
.top5-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top5-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top5-val { font-size: 19px; font-weight: 600; color: var(--brand); font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.top5-val small { font-size: 11px; color: var(--text-3); font-weight: 500; margin-left: 2px; }

/* ----------------------------- 展开全部 ----------------------------- */
.expand-box { margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--border); }
.expand-toggle { display: inline-flex; align-items: center; gap: 6px; border: none; background: none; padding: 4px 0; font-size: 12.5px; color: var(--brand); cursor: pointer; }
.expand-toggle:hover { text-decoration: underline; }
.expand-toggle .ico { transition: transform 180ms ease; }
.expand-toggle.open .ico { transform: rotate(180deg); }
.expand-panel { margin-top: 8px; max-height: 420px; overflow-y: auto; }
.mini-note { font-size: 11.5px; color: var(--text-3); margin-top: 10px; }

/* 规则卡内的原始 JSON 只读视图：限高内滚，避免 weight_json 撑爆整页高度 */
.card .json-view { max-height: 320px; overflow: auto; }
