/* ============================================================
   components.css · 通用组件库
   ============================================================ */

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  height: 34px; padding: 0 13px;
  border-radius: var(--r-md);
  font-size: var(--fs-13); font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: background .15s var(--ease), border-color .15s var(--ease),
              box-shadow .15s var(--ease), color .15s var(--ease), transform .1s var(--ease);
  user-select: none;
}
.btn:active { transform: translateY(.5px); }
.btn--sm { height: 28px; padding: 0 9px; font-size: var(--fs-12); border-radius: var(--r-sm); gap: 5px; }
.btn--lg { height: 40px; padding: 0 18px; font-size: var(--fs-14); border-radius: var(--r-lg); }
.btn--xl { height: 46px; padding: 0 22px; font-size: var(--fs-15); border-radius: var(--r-lg); }
.btn--block { width: 100%; }
.btn--icon { width: 34px; padding: 0; }
.btn--icon.btn--sm { width: 28px; }

.btn--primary {
  background: var(--brand-600); color: #fff;
  box-shadow: var(--sh-brand);
}
.btn--primary:hover { background: var(--brand-700); }
.btn--primary:active { box-shadow: 0 2px 8px rgba(37, 99, 235, .28); }

.btn--ai {
  background: var(--ai-grad); color: #fff;
  box-shadow: var(--sh-ai);
}
.btn--ai:hover { filter: brightness(1.06); }

.btn--default {
  background: var(--surface); color: var(--text-2);
  border-color: var(--line-strong);
  box-shadow: var(--sh-1);
}
.btn--default:hover { color: var(--text); border-color: var(--line-dark); background: var(--surface-2); }

.btn--soft { background: var(--brand-50); color: var(--brand-700); }
.btn--soft:hover { background: var(--brand-100); }

.btn--ghost { background: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-3); color: var(--text); }

.btn--danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-bd); }
.btn--danger:hover { background: #fbdcd9; }

.btn--link { height: auto; padding: 0; color: var(--brand-600); font-weight: 600; }
.btn--link:hover { text-decoration: underline; }

.btn.is-disabled, .btn:disabled { opacity: .45; box-shadow: none; }

/* 图标按钮 */
.icon-btn {
  width: 32px; height: 32px; flex: none;
  border-radius: var(--r-md);
  display: grid; place-items: center;
  color: var(--text-3);
  transition: background .15s var(--ease), color .15s var(--ease);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.is-active { background: var(--brand-50); color: var(--brand-600); }
.icon-btn--sm { width: 26px; height: 26px; border-radius: var(--r-sm); }
.icon-btn--dark { color: #97a2b8; }
.icon-btn--dark:hover { background: rgba(255, 255, 255, .1); color: #fff; }

/* 按钮组 */
.btn-group {
  display: inline-flex; padding: 2px; gap: 2px;
  background: var(--surface-3);
  border-radius: var(--r-md);
}
.btn-group .btn { height: 28px; background: transparent; color: var(--text-2); box-shadow: none; font-weight: 400; border: 0; }
.btn-group .btn:hover { background: rgba(255, 255, 255, .7); color: var(--text); }
.btn-group .btn.is-active { background: var(--surface); color: var(--brand-700); box-shadow: var(--sh-1); font-weight: 600; }

/* 分段控件 */
.segmented {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--surface-3); border-radius: var(--r-md);
}
.segmented__item {
  height: 26px; padding: 0 11px;
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: var(--r-sm);
  font-size: var(--fs-12); font-weight: 400; color: var(--text-2);
  transition: all .15s var(--ease);
}
.segmented__item:hover { color: var(--text); }
.segmented__item.is-active { background: var(--surface); color: var(--brand-700); font-weight: 600; box-shadow: var(--sh-1); }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
}
.card--flat { box-shadow: none; }
.card--hover { transition: box-shadow .18s var(--ease), border-color .18s var(--ease), transform .18s var(--ease); }
.card--hover:hover { box-shadow: var(--sh-3); border-color: var(--line-strong); transform: translateY(-2px); }
.card--ai { border-color: #ddd6fe; background: linear-gradient(180deg, #fdfcff 0%, #fff 60%); }

.card__head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}
.card__head--plain { border-bottom: 0; padding-bottom: 0; }
.card__title { font-size: var(--fs-14); font-weight: 600; display: flex; align-items: center; gap: 7px; min-width: 0; }
.card__sub { font-size: var(--fs-12); color: var(--text-3); }
.card__body { padding: 16px; }
.card__body--flush { padding: 0; }
.card__body--tight { padding: 10px 12px; }
.card__foot {
  padding: 11px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  display: flex; align-items: center; gap: 10px;
}

/* ---------------- 标签 / 徽标 ---------------- */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  height: 21px; padding: 0 8px;
  border-radius: var(--r-sm);
  font-size: var(--fs-11); font-weight: 600;
  background: var(--surface-3); color: var(--text-2);
  border: 1px solid transparent;
  white-space: nowrap;
}
.tag--brand  { background: var(--brand-50);   color: var(--brand-700);   border-color: var(--brand-100); }
.tag--success{ background: var(--success-bg); color: var(--success);     border-color: var(--success-bd); }
.tag--warn   { background: var(--warn-bg);    color: var(--warn);        border-color: var(--warn-bd); }
.tag--danger { background: var(--danger-bg);  color: var(--danger);      border-color: var(--danger-bd); }
.tag--info   { background: var(--info-bg);    color: var(--info);        border-color: var(--info-bd); }
.tag--violet { background: var(--violet-bg);  color: var(--violet);      border-color: var(--violet-bd); }
.tag--ai     { background: var(--ai-grad-soft); color: var(--violet);    border-color: var(--violet-bd); }
.tag--outline{ background: transparent; border-color: var(--line-strong); color: var(--text-3); }

.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-4); flex: none; }
.badge-dot--ok { background: var(--success); }
.badge-dot--warn { background: var(--warn); }
.badge-dot--err { background: var(--danger); }
.badge-dot--brand { background: var(--brand-500); }
.badge-dot--pulse { animation: pulseDot 1.4s var(--ease) infinite; }

/* 计数徽标 */
.count {
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--r-full);
  background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 600;
  display: inline-grid; place-items: center;
  font-variant-numeric: tabular-nums;
}
.count--soft { background: var(--surface-3); color: var(--text-3); }

/* ---------------- 头像 ---------------- */
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: var(--fs-12); font-weight: 600;
  color: #fff; flex: none; user-select: none;
  background: linear-gradient(135deg, #64748b, #475569);
}
.avatar--sm { width: 26px; height: 26px; font-size: 11px; }
.avatar--lg { width: 44px; height: 44px; font-size: var(--fs-15); }
.avatar--c1 { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.avatar--c2 { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.avatar--c3 { background: linear-gradient(135deg, #10b981, #059669); }
.avatar--c4 { background: linear-gradient(135deg, #f59e0b, #d97706); }
.avatar--c5 { background: linear-gradient(135deg, #ec4899, #db2777); }
.avatar--c6 { background: linear-gradient(135deg, #06b6d4, #0891b2); }

.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -8px; border: 2px solid var(--surface); }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ---------------- 表单 ---------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label {
  font-size: var(--fs-12); font-weight: 600; color: var(--text-2);
  display: flex; align-items: center; gap: 5px;
}
.field__label .req { color: var(--danger); }
.field__hint { font-size: var(--fs-11); color: var(--text-4); }

.input, .textarea, .select {
  width: 100%;
  min-height: 34px;
  padding: 7px 11px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  font-size: var(--fs-13);
  color: var(--text);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--text-4); }
.input:hover, .textarea:hover, .select:hover { border-color: var(--line-dark); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: var(--ring);
}
.textarea { resize: vertical; line-height: 1.65; min-height: 76px; }
.select {
  appearance: none;
  padding-right: 30px;
  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='%238b93a5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}
.input--sm { min-height: 28px; padding: 4px 9px; font-size: var(--fs-12); }
.input--flush { border-color: transparent; background: var(--surface-3); }
.input--flush:focus { background: var(--surface); border-color: var(--brand-500); }

/* 搜索框 */
.searchbox {
  display: flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 11px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.searchbox:focus-within { border-color: var(--brand-500); box-shadow: var(--ring); }
.searchbox input { flex: 1; min-width: 0; border: 0; outline: none; background: none; font-size: var(--fs-13); }
.searchbox input::placeholder { color: var(--text-4); }
.searchbox__ico { color: var(--text-4); flex: none; }
.searchbox--lg { height: 46px; border-radius: var(--r-lg); padding: 0 14px; }
.searchbox--lg input { font-size: var(--fs-15); }

/* 开关 */
.switch {
  width: 36px; height: 20px; flex: none;
  border-radius: var(--r-full);
  background: var(--line-dark);
  position: relative; cursor: pointer;
  transition: background .2s var(--ease);
}
/* 视觉上仍是 36×20，但把点击区域扩到 36×28（WCAG 2.2 要求至少 24×24）。
   用 ::before 而不是 ::after —— 后者是滑块圆点。 */
.switch::before {
  content: ""; position: absolute; inset: -4px 0;
  border-radius: var(--r-full);
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: var(--sh-1);
  transition: transform .2s var(--ease-out);
}
.switch.is-on { background: var(--brand-600); }
.switch.is-on::after { transform: translateX(16px); }

/* 复选 / 单选 */
.checkbox, .radio {
  width: 16px; height: 16px; flex: none;
  border: 1.5px solid var(--line-dark);
  background: var(--surface);
  display: grid; place-items: center;
  color: transparent; cursor: pointer;
  transition: all .14s var(--ease);
}
.checkbox { border-radius: var(--r-xs); }
.radio { border-radius: 50%; }
.checkbox:hover, .radio:hover { border-color: var(--brand-400); }
.checkbox.is-checked { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.radio.is-checked { border-color: var(--brand-600); border-width: 5px; }

/* 滑块 */
.slider { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 2px; background: var(--surface-3); outline: none; }
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--brand-600); cursor: pointer; border: 2px solid #fff; box-shadow: var(--sh-2);
}

/* ---------------- 表格 ---------------- */
.table-wrap { overflow: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-13); }
.table th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2);
  text-align: left;
  font-size: var(--fs-11); font-weight: 600;
  color: var(--text-3);
  letter-spacing: .04em;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text-2);
  vertical-align: middle;
}
.table tbody tr:hover td { background: var(--brand-50); }
.table tbody tr.is-selected td { background: var(--brand-50); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.strong { color: var(--text); font-weight: 600; }
.table--compact th, .table--compact td { padding: 6px 10px; }
.table--bordered td, .table--bordered th { border-right: 1px solid var(--line); }
.table--bordered td:last-child, .table--bordered th:last-child { border-right: 0; }
.table td.editable { background: #fffdf5; cursor: text; }
.table td.editable:focus { outline: 2px solid var(--brand-400); outline-offset: -2px; background: #fff; }
.table .cell-input {
  width: 100%; border: 0; background: transparent; outline: none;
  font: inherit; color: var(--text); padding: 0;
  font-variant-numeric: tabular-nums;
}

/* ---------------- 列表行 ---------------- */
.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  transition: background .14s var(--ease);
  cursor: pointer;
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-2); }
.list-row.is-active { background: var(--brand-50); }
.list-row__main { flex: 1; min-width: 0; }
.list-row__title { font-size: var(--fs-13); font-weight: 600; color: var(--text); }
.list-row__sub { font-size: var(--fs-12); color: var(--text-3); margin-top: 2px; }
.list-row__meta { flex: none; display: flex; align-items: center; gap: 8px; }

/* 文件缩略图标 */
.ftile {
  width: 34px; height: 34px; flex: none;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
  color: #fff; text-transform: uppercase;
}
.ftile--pdf  { background: linear-gradient(135deg, #f87171, #dc2626); }
.ftile--doc  { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.ftile--xls  { background: linear-gradient(135deg, #4ade80, #16a34a); }
.ftile--ppt  { background: linear-gradient(135deg, #fb923c, #ea580c); }
.ftile--img  { background: linear-gradient(135deg, #c084fc, #9333ea); }
.ftile--vid  { background: linear-gradient(135deg, #f472b6, #db2777); }
.ftile--aud  { background: linear-gradient(135deg, #22d3ee, #0891b2); }
.ftile--txt  { background: linear-gradient(135deg, #94a3b8, #64748b); }
.ftile--md   { background: linear-gradient(135deg, #2dd4bf, #0d9488); }
.ftile--lg   { width: 44px; height: 44px; font-size: 12px; border-radius: var(--r-md); }

/* ---------------- 进度条 ---------------- */
.progress {
  height: 6px; border-radius: var(--r-full);
  background: var(--surface-3); overflow: hidden;
  position: relative;
}
.progress__bar {
  height: 100%; border-radius: var(--r-full);
  background: var(--brand-500);
  transition: width .5s var(--ease-out);
}
.progress--sm { height: 4px; }
.progress--lg { height: 8px; }
.progress__bar--grad { background: var(--ai-grad); }
.progress__bar--ok { background: var(--success); }
.progress__bar--warn { background: var(--warn); }

/* 环形进度 */
.ring { position: relative; display: grid; place-items: center; }
.ring svg { transform: rotate(-90deg); }
.ring__val {
  position: absolute; font-size: var(--fs-13); font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---------------- 统计卡 ---------------- */
.stat {
  padding: 15px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  display: flex; flex-direction: column; gap: 3px;
  min-width: 0;
}
.stat__label { font-size: var(--fs-12); color: var(--text-3); display: flex; align-items: center; gap: 5px; }
.stat__value {
  font-size: var(--fs-24); font-weight: 700; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; line-height: 1.25;
}
.stat__value small { font-size: var(--fs-12); font-weight: 400; color: var(--text-3); margin-left: 3px; }
.stat__delta { font-size: var(--fs-11); display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
.stat__delta--up { color: var(--success); }
.stat__delta--down { color: var(--danger); }
.stat__delta--flat { color: var(--text-4); }

/* ---------------- 分段标题 ---------------- */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.section-head__title {
  font-size: var(--fs-15); font-weight: 600;
  display: flex; align-items: center; gap: 8px;
  letter-spacing: -.01em;
}
.section-head__desc { font-size: var(--fs-12); color: var(--text-3); margin-top: 2px; }

/* ---------------- 标签页 ---------------- */
.tabs {
  display: flex; align-items: center; gap: 2px;
  border-bottom: 1px solid var(--line);
  padding: 0 2px;
}
.tab {
  position: relative;
  height: 38px; padding: 0 13px;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-13); font-weight: 400; color: var(--text-3);
  transition: color .15s var(--ease);
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--brand-600); font-weight: 600; }
.tab.is-active::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px;
  height: 2px; border-radius: 2px 2px 0 0; background: var(--brand-600);
}
.tab .count { transform: scale(.9); }

/* 药丸标签页 */
.pills { display: flex; gap: 7px; flex-wrap: wrap; }
.pill {
  height: 30px; padding: 0 13px;
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: var(--r-full);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  font-size: var(--fs-12); font-weight: 400; color: var(--text-2);
  transition: all .15s var(--ease);
  white-space: nowrap;
}
.pill:hover { border-color: var(--brand-300); color: var(--brand-700); }
.pill.is-active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; font-weight: 600; }

/* ---------------- 芯片（AI 建议） ---------------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 11px;
  border-radius: var(--r-full);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  font-size: var(--fs-12); color: var(--text-2);
  transition: all .15s var(--ease); cursor: pointer;
  text-align: left;
}
.chip:hover { border-color: var(--violet-bd); background: var(--violet-bg); color: var(--violet); }
.chip--ai { background: var(--ai-grad-soft); border-color: #e2d9fe; color: var(--violet); font-weight: 600; }

/* ---------------- 提示条 ---------------- */
.banner {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 14px;
  border-radius: var(--r-md);
  font-size: var(--fs-13);
  border: 1px solid transparent;
  line-height: 1.55;
}
.banner--ai { background: var(--ai-grad-soft); border-color: #e4dcfd; color: #4c3d8f; }
.banner--info { background: var(--info-bg); border-color: var(--info-bd); color: #075985; }
.banner--warn { background: var(--warn-bg); border-color: var(--warn-bd); color: #92400e; }
.banner--success { background: var(--success-bg); border-color: var(--success-bd); color: #14532d; }
.banner--danger { background: var(--danger-bg); border-color: var(--danger-bd); color: #991b1b; }
.banner__ico { flex: none; margin-top: 1px; }

/* ---------------- 引用标记 ---------------- */
.cite {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: var(--r-xs);
  background: var(--brand-50); color: var(--brand-700);
  font-size: 11px; font-weight: 600;
  vertical-align: super;
  margin: 0 1px;
  cursor: pointer;
  transition: background .14s var(--ease);
  font-variant-numeric: tabular-nums;
}
.cite:hover { background: var(--brand-600); color: #fff; }

/* ---------------- 时间轴 ---------------- */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 12px; position: relative; padding-bottom: 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item__rail { flex: none; width: 20px; display: flex; flex-direction: column; align-items: center; }
.tl-item__dot {
  width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-3);
  font-size: 11px; font-weight: 600;
  border: 1px solid var(--line);
  flex: none; margin-top: 1px;
}
.tl-item__dot--brand { background: var(--brand-600); color: #fff; border-color: var(--brand-600); }
.tl-item__dot--ok { background: var(--success); color: #fff; border-color: var(--success); }
.tl-item__line { flex: 1; width: 2px; background: var(--line); margin: 3px 0 -3px; border-radius: 2px; }
.tl-item__body { flex: 1; min-width: 0; padding-top: 0; }
.tl-item__title { font-size: var(--fs-13); font-weight: 600; }
.tl-item__desc { font-size: var(--fs-12); color: var(--text-3); margin-top: 2px; line-height: 1.55; }

/* ---------------- 向导步骤 ---------------- */
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper__item { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: var(--r-full); }
.stepper__num {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-3);
  font-size: 12px; font-weight: 600; flex: none;
  border: 1px solid var(--line);
}
.stepper__text { font-size: var(--fs-12); color: var(--text-3); font-weight: 400; white-space: nowrap; }
.stepper__item.is-active { background: var(--brand-50); }
.stepper__item.is-active .stepper__num { background: var(--brand-600); color: #fff; border-color: var(--brand-600); }
.stepper__item.is-active .stepper__text { color: var(--brand-700); font-weight: 600; }
.stepper__item.is-done .stepper__num { background: var(--success-bg); color: var(--success); border-color: var(--success-bd); }
.stepper__sep { color: var(--line-dark); flex: none; }

/* ---------------- 上传区 ---------------- */
.dropzone {
  border: 1.5px dashed var(--line-dark);
  border-radius: var(--r-lg);
  padding: 26px 20px;
  text-align: center;
  background: var(--surface-2);
  transition: all .18s var(--ease);
  cursor: pointer;
}
.dropzone:hover, .dropzone.is-over {
  border-color: var(--brand-400);
  background: var(--brand-50);
}
.dropzone__ico {
  width: 46px; height: 46px; margin: 0 auto 10px;
  border-radius: var(--r-lg);
  display: grid; place-items: center;
  background: var(--surface); color: var(--brand-600);
  box-shadow: var(--sh-2);
}

/* ---------------- 骨架屏 ---------------- */
.skeleton {
  background: linear-gradient(90deg, var(--surface-3) 25%, #e9edf4 37%, var(--surface-3) 63%);
  background-size: 420px 100%;
  animation: shimmer 1.3s linear infinite;
  border-radius: var(--r-sm);
}
.sk-line { height: 11px; margin-bottom: 8px; }
.sk-line:last-child { margin-bottom: 0; width: 62%; }

/* ---------------- 模态框 ---------------- */
.modal-root { position: fixed; inset: 0; z-index: 200; pointer-events: none; }
.modal-mask {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(3px);
  display: grid; place-items: center;
  pointer-events: auto;
  animation: fadeIn .18s var(--ease) both;
  padding: 32px;
}
.modal {
  width: 100%; max-width: 560px;
  max-height: calc(100vh - 80px);
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-4);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: popIn .26s var(--ease-out) both;
}
.modal--wide { max-width: 860px; }
.modal__head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.modal__title { font-size: var(--fs-16); font-weight: 600; flex: 1; }
.modal__body { padding: 18px; flex: 1; min-height: 0; overflow: auto; }
.modal__foot {
  padding: 13px 18px;
  border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: flex-end; gap: 9px;
  background: var(--surface-2);
}

/* ---------------- 轻提示 ---------------- */
.toasts {
  position: fixed; bottom: 22px; left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 16px;
  background: var(--surface-inverse);
  color: #eef2f9;
  border-radius: var(--r-full);
  font-size: var(--fs-13);
  box-shadow: var(--sh-4);
  animation: popIn .26s var(--ease-out) both;
  pointer-events: auto;
  max-width: 520px;
}
.toast__ico { color: #7dd3fc; flex: none; }
.toast--ok .toast__ico { color: #6ee7b7; }
.toast--warn .toast__ico { color: #fcd34d; }
.toast--err .toast__ico { color: #fca5a5; }

/* ---------------- 悬浮提示 ----------------
   用真实元素而不是 ::after。原因：.switch 用 ::after 画滑块圆点、
   .rail__item.is-active 用 ::before 画高亮条，伪元素方案必然打架
   （浏览器会把两条规则混着用，几何取一边、内容取另一边）。
   真实元素还能自动翻边与贴边，不会被 overflow 容器裁掉。 */
.app-tip {
  position: fixed;
  left: -9999px; top: -9999px;
  z-index: 500;
  padding: 5px 10px;
  background: var(--surface-inverse);
  color: #fff;
  font-size: var(--fs-12);
  font-weight: 400;
  line-height: 1.4;
  border-radius: var(--r-sm);
  box-shadow: var(--sh-3);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity .14s var(--ease), transform .14s var(--ease);
}
.app-tip.is-on { opacity: 1; transform: none; }

/* ---------------- 分隔 / 键帽 ---------------- */
.kbd {
  display: inline-grid; place-items: center;
  min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: var(--r-xs);
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  font-size: 11px; font-family: var(--mono); color: var(--text-3);
}
.divider { height: 1px; background: var(--line); }
.divider--v { width: 1px; align-self: stretch; background: var(--line); }
.dot-sep { color: var(--line-dark); }

/* ---------------- 树 ---------------- */
.tree { font-size: var(--fs-13); }
.tree__row {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px; border-radius: var(--r-sm);
  cursor: pointer; color: var(--text-2);
}
.tree__row:hover { background: var(--surface-3); }
.tree__row.is-active { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
.tree__caret { color: var(--text-4); transition: transform .16s var(--ease); flex: none; }
.tree__caret.is-open { transform: rotate(90deg); }
.tree__children { padding-left: 15px; }

/* ---------------- 元信息网格 ---------------- */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: var(--fs-12); }
.kv dt { color: var(--text-4); white-space: nowrap; }
.kv dd { color: var(--text-2); min-width: 0; }

/* ---------------- 工具条 ---------------- */
.toolbar {
  display: flex; align-items: center; gap: 4px;
  padding: 5px 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.toolbar__sep { width: 1px; height: 18px; background: var(--line); margin: 0 3px; flex: none; }
.toolbar .icon-btn { width: 28px; height: 28px; border-radius: var(--r-sm); }

/* ---------------- 迷你图表 ---------------- */
.spark { display: block; }
.bars { display: flex; align-items: flex-end; gap: 5px; height: 100%; }
.bars__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; height: 100%; justify-content: flex-end; }
.bars__bar {
  width: 100%; max-width: 34px;
  border-radius: var(--r-sm) var(--r-sm) 2px 2px;
  background: linear-gradient(180deg, #93bbfd, #3b7ff6);
  transform-origin: bottom;
  animation: barGrow .6s var(--ease-out) both;
  min-height: 3px;
}
.bars__bar--alt { background: linear-gradient(180deg, #c4b5fd, #8b5cf6); }
.bars__label { font-size: 12px; color: var(--text-4); white-space: nowrap; }

/* 热力格 */
.heat { display: grid; gap: 3px; }
.heat__cell { aspect-ratio: 1; border-radius: 3px; background: var(--surface-3); }

/* 迷你进度环列表 */
.meter-row { display: flex; align-items: center; gap: 10px; }
.meter-row__label { width: 96px; flex: none; font-size: var(--fs-12); color: var(--text-2); }
.meter-row__val { width: 40px; flex: none; text-align: right; font-size: var(--fs-12); font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }

/* ---------------- 分段内容切换 ---------------- */
.tabpane { display: none; }
.tabpane.is-active { display: block; animation: fadeIn .22s var(--ease) both; }

/* ---------------- 滚动阴影 ---------------- */
.scroll-y { overflow-y: auto; overflow-x: hidden; }

/* ============================================================
   全局命令面板（Ctrl / Cmd + K）
   ============================================================ */
.cmdk { position: fixed; inset: 0; z-index: 400; }
.cmdk__mask {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, .38);
  backdrop-filter: blur(4px);
  animation: fadeIn .16s var(--ease) both;
}
.cmdk__panel {
  position: absolute; left: 50%; top: 12vh;
  transform: translateX(-50%);
  width: min(640px, calc(100vw - 32px));
  max-height: 68vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-4);
  overflow: hidden;
  animation: cmdkIn .22s var(--ease-out) both;
}
@keyframes cmdkIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px) scale(.985); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

.cmdk__head {
  display: flex; align-items: center; gap: 11px;
  padding: 14px 14px 14px 18px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.cmdk__head-ico { color: var(--text-4); }
.cmdk__input {
  flex: 1; min-width: 0;
  border: 0; outline: none; background: none;
  font-size: var(--fs-16); color: var(--text);
  font-weight: 400;
}
.cmdk__input::placeholder { color: var(--text-4); }

.cmdk__list { flex: 1; min-height: 0; overflow: auto; padding: 8px; }
.cmdk__group {
  font-size: var(--fs-11); font-weight: 600; color: var(--text-4);
  padding: 10px 10px 5px;
}
.cmdk__group:first-child { padding-top: 4px; }

.cmdk__item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background .1s var(--ease);
}
.cmdk__item.is-active { background: var(--brand-50); }
.cmdk__ico {
  width: 28px; height: 28px; flex: none;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  border: 1px solid transparent;
}
.cmdk__main { flex: 1; min-width: 0; }
.cmdk__title {
  display: block; font-size: var(--fs-13); font-weight: 400; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cmdk__item.is-active .cmdk__title { font-weight: 600; color: var(--brand-700); }
.cmdk__sub {
  display: block; font-size: var(--fs-11); color: var(--text-4);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px;
}
.cmdk__enter { color: var(--brand-500); flex: none; }

.cmdk__empty {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 44px 20px; color: var(--text-4); text-align: center;
}
.cmdk__empty-t { font-size: var(--fs-14); font-weight: 600; color: var(--text-2); margin-top: 6px; }
.cmdk__empty-d { font-size: var(--fs-12); }

.cmdk__foot {
  display: flex; align-items: center; gap: 14px;
  padding: 9px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  font-size: var(--fs-11); color: var(--text-4);
  flex: none;
}
.cmdk__foot > span { display: inline-flex; align-items: center; gap: 4px; }
.cmdk__count { color: var(--text-4); }

/* 顶栏命令入口 */
.topbar__cmd {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 7px 0 11px;
  min-width: 0; max-width: 260px;
  border-radius: var(--r-md);
  background: var(--surface-3);
  border: 1px solid transparent;
  color: var(--text-4);
  font-size: var(--fs-12);
  white-space: nowrap;
  transition: all .15s var(--ease);
}
.topbar__cmd > span:first-of-type {
  flex: 1 1 auto; min-width: 0;
  text-align: left;
  overflow: hidden; text-overflow: ellipsis;
}
.topbar__cmd .kbd { flex: none; }
.topbar__cmd:hover { background: var(--surface); border-color: var(--line-strong); color: var(--text-2); }
@media (max-width: 1280px) {
  .topbar__cmd > span:first-of-type { display: none; }
  .topbar__cmd { padding: 0 8px; }
}
