/* ==========================================================================
   基础与通用组件
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-14);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss03";
}

h1, h2, h3, h4, h5, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
h1, h2, h3, h4, h5 { font-weight: 600; letter-spacing: -.01em; line-height: 1.3; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
table { border-collapse: collapse; width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--sp-5) 0; }
code, kbd, pre { font-family: var(--font-mono); }
::selection { background: color-mix(in oklab, var(--brand) 22%, transparent); }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.scroll-thin { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* 工具类 */
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: .92em; letter-spacing: -.01em; }
.muted { color: var(--text-3); }
.sub { color: var(--text-2); }
.small { font-size: var(--fs-13); }
.tiny { font-size: var(--fs-12); }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.right { text-align: right; }
.center { text-align: center; }
.up { color: var(--success-text); }
.down { color: var(--danger-text); }
.hidden { display: none !important; }
.grow { flex: 1; min-width: 0; }

.row { display: flex; align-items: center; gap: var(--sp-3); }
.row-2 { display: flex; align-items: center; gap: var(--sp-2); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.stack-2 { display: flex; flex-direction: column; gap: var(--sp-2); }
.stack-5 { display: flex; flex-direction: column; gap: var(--sp-5); }

.grid { display: grid; gap: var(--sp-4); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1fr) 340px; }
.g-side { grid-template-columns: 240px minmax(0, 1fr); }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mt-5 { margin-top: var(--sp-5); }

@media (max-width: 1280px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .g-2, .g-3, .g-4 { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: var(--ctl-h);
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-3);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-13);
  font-weight: 500;
  white-space: nowrap;
  box-shadow: var(--shadow-1);
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.btn:hover { background: var(--surface-2); border-color: var(--text-4); }
.btn:active { transform: translateY(.5px); }
.btn i { font-size: 13px; }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
  box-shadow: 0 1px 2px color-mix(in oklab, var(--brand) 40%, transparent), inset 0 1px 0 rgb(255 255 255 / .14);
}
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-primary:active { background: var(--brand-active); }

.btn-soft { background: var(--brand-soft); border-color: transparent; color: var(--brand-text); box-shadow: none; }
.btn-soft:hover { background: var(--brand-soft-2); border-color: transparent; }

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

.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: color-mix(in oklab, var(--danger) 88%, #000); border-color: transparent; }
.btn-danger-soft { background: var(--danger-soft); border-color: transparent; color: var(--danger-text); box-shadow: none; }
.btn-danger-soft:hover { background: color-mix(in oklab, var(--danger) 16%, var(--surface)); border-color: transparent; }

.btn-link { height: auto; padding: 0; border: 0; background: none; box-shadow: none; color: var(--brand-text); }
.btn-link:hover { background: none; text-decoration: underline; text-underline-offset: 3px; }

.btn-sm { height: var(--ctl-h-sm); padding: 0 10px; font-size: var(--fs-12); border-radius: var(--r-2); }
.btn-lg { height: var(--ctl-h-lg); padding: 0 20px; font-size: var(--fs-14); }
.btn-block { width: 100%; }
.btn-icon { width: var(--ctl-h); padding: 0; }
.btn-icon.btn-sm { width: var(--ctl-h-sm); }

.btn.is-loading { color: transparent; position: relative; pointer-events: none; }
.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--text-3);
  border-right-color: transparent;
  animation: spin .7s linear infinite;
}
.btn-primary.is-loading::after { border-color: var(--brand-ink); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; box-shadow: none; }
.btn-group .btn:first-child { border-radius: var(--r-3) 0 0 var(--r-3); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--r-3) var(--r-3) 0; }
.btn-group .btn.is-active { background: var(--surface-3); position: relative; z-index: 1; }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.label { font-size: var(--fs-13); font-weight: 500; color: var(--text); }
.label .req { color: var(--danger-text); margin-left: 2px; }
.hint { font-size: var(--fs-12); color: var(--text-3); }
.hint.is-error { color: var(--danger-text); }
@media (max-width: 640px) { .field-row { grid-template-columns: minmax(0, 1fr); } }

.input, .textarea, .select-native {
  width: 100%;
  height: var(--ctl-h);
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-3);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-14);
  outline: 0;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.textarea { height: auto; min-height: 88px; padding: 8px 11px; line-height: 1.6; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--text-4); }
.input:hover, .textarea:hover, .select-native:hover { border-color: var(--text-4); }
.input:focus, .textarea:focus, .select-native:focus { border-color: var(--brand); box-shadow: var(--focus-ring); }
.input[disabled], .textarea[disabled] { background: var(--surface-3); color: var(--text-3); cursor: not-allowed; }
.input.is-error, .textarea.is-error { border-color: var(--danger); }
.input.is-error:focus { box-shadow: 0 0 0 3px color-mix(in oklab, var(--danger) 20%, transparent); }
.input-sm { height: var(--ctl-h-sm); font-size: var(--fs-13); border-radius: var(--r-2); }

.input-wrap { position: relative; display: flex; align-items: center; min-width: 0; }
.input-wrap > i { position: absolute; left: 11px; color: var(--text-3); font-size: 13px; pointer-events: none; }
.input-wrap > .input { padding-left: 32px; }
.input-wrap > .trail { position: absolute; right: 8px; color: var(--text-3); font-size: var(--fs-12); }
.input-wrap > button.trail { padding: 4px; cursor: pointer; }
.input-wrap > button.trail:hover { color: var(--text); }

.input-group { display: flex; min-width: 0; }
.input-group .addon {
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text-3);
  font-size: var(--fs-13);
  white-space: nowrap;
}
.input-group .addon:first-child { border-right: 0; border-radius: var(--r-3) 0 0 var(--r-3); }
.input-group .addon:last-child { border-left: 0; border-radius: 0 var(--r-3) var(--r-3) 0; }
.input-group .input { border-radius: 0; }
.input-group .input:first-child { border-radius: var(--r-3) 0 0 var(--r-3); }
.input-group .input:last-child { border-radius: 0 var(--r-3) var(--r-3) 0; }

/* 复选 / 单选 */
.check, .radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-13);
  cursor: pointer;
  user-select: none;
}
.check input, .radio input { position: absolute; opacity: 0; width: 0; height: 0; }
.check .box, .radio .box {
  flex: none;
  position: relative;
  width: 16px;
  height: 16px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}
.check .box { border-radius: var(--r-1); }
.radio .box { border-radius: 50%; }
.check:hover .box, .radio:hover .box { border-color: var(--brand); }
.check input:focus-visible + .box, .radio input:focus-visible + .box { box-shadow: var(--focus-ring); border-color: var(--brand); }
.check input:checked + .box, .check input:indeterminate + .box { background: var(--brand); border-color: var(--brand); }
.check input:checked + .box::after {
  content: "";
  position: absolute;
  left: 4.5px;
  top: 1.5px;
  width: 5px;
  height: 9px;
  border: solid var(--brand-ink);
  border-width: 0 2px 2px 0;
  transform: rotate(42deg);
}
.check input:indeterminate + .box::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  top: 6.5px;
  height: 2px;
  border-radius: 1px;
  background: var(--brand-ink);
}
.radio input:checked + .box { border: 5px solid var(--brand); }

/* 开关 */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: var(--fs-13); user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  flex: none;
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: var(--r-full);
  background: var(--line-strong);
  transition: background var(--t-base) var(--ease);
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / .24);
  transition: transform var(--t-base) var(--ease);
}
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { box-shadow: var(--focus-ring); }

/* 分段控件 */
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r-3); background: var(--surface-3); }
.segmented button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: calc(var(--ctl-h) - 8px);
  padding: 0 12px;
  border-radius: var(--r-2);
  color: var(--text-2);
  font-size: var(--fs-13);
  font-weight: 500;
  white-space: nowrap;
  transition: color var(--t-fast), background var(--t-fast);
}
.segmented button:hover { color: var(--text); }
.segmented button.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }

/* ---------- 标签与状态 ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--r-2);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: var(--fs-12);
  font-weight: 500;
  white-space: nowrap;
}
.tag i { font-size: 10px; }
.tag.is-brand { background: var(--brand-soft); color: var(--brand-text); }
.tag.is-success { background: var(--success-soft); color: var(--success-text); }
.tag.is-warning { background: var(--warning-soft); color: var(--warning-text); }
.tag.is-danger { background: var(--danger-soft); color: var(--danger-text); }
.tag.is-info { background: var(--info-soft); color: var(--info-text); }
.tag.is-outline { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); }

.status { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-13); white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--text-4); }
.status.is-success::before { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.status.is-warning::before { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }
.status.is-danger::before { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.status.is-info::before { background: var(--info); box-shadow: 0 0 0 3px var(--info-soft); }

.count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: var(--fs-11);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.count.is-brand { background: var(--brand); color: var(--brand-ink); }
.count.is-danger { background: var(--danger); color: #fff; }

kbd {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: var(--r-1);
  background: var(--surface);
  color: var(--text-3);
  font-size: var(--fs-11);
}

/* ---------- 头像 ---------- */
.avatar {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--brand-soft-2);
  color: var(--brand-text);
  font-size: var(--fs-12);
  font-weight: 600;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 24px; height: 24px; font-size: var(--fs-11); }
.avatar.lg { width: 44px; height: 44px; font-size: var(--fs-16); }
.avatar.xl { width: 72px; height: 72px; font-size: var(--fs-24); }
.avatar.is-square { border-radius: var(--r-3); }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { box-shadow: 0 0 0 2px var(--surface); margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-4);
  box-shadow: var(--shadow-1);
  min-width: 0;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: 16px 20px;
  min-height: 56px;
}
.card-head.is-line { border-bottom: 1px solid var(--line); }
.card-title { font-size: var(--fs-14); font-weight: 600; }
.card-desc { margin-top: 2px; font-size: var(--fs-12); color: var(--text-3); font-weight: 400; }
.card-body { padding: 20px; }
.card-head + .card-body { padding-top: 4px; }
.card-head.is-line + .card-body { padding-top: 20px; }
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: 12px 20px;
  border-top: 1px solid var(--line);
}
.card-flush { padding: 0; }

/* 指标卡 */
.stat { position: relative; padding: 18px 20px; overflow: hidden; }
.stat-label { display: flex; align-items: center; gap: 7px; color: var(--text-2); font-size: var(--fs-13); }
.stat-label i { color: var(--text-3); font-size: 12px; }
.stat-value {
  margin-top: 8px;
  font-size: var(--fs-30);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -.025em;
  font-variant-numeric: tabular-nums;
}
.stat-value small { font-size: var(--fs-14); font-weight: 500; letter-spacing: 0; color: var(--text-3); margin-left: 3px; }
.stat-foot { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: var(--fs-12); color: var(--text-3); }
.stat-delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-delta i { font-size: 10px; }
.stat-spark { position: absolute; right: 16px; top: 18px; width: 96px; height: 44px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
.table { font-size: var(--fs-13); }
.table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  color: var(--text-3);
  font-size: var(--fs-12);
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}
.table th.is-sortable { cursor: pointer; user-select: none; }
.table th.is-sortable:hover { color: var(--text); }
.table th .sort { margin-left: 5px; font-size: 10px; opacity: .45; }
.table th.is-sorted { color: var(--text); }
.table th.is-sorted .sort { opacity: 1; color: var(--brand-text); }
.table td {
  padding: var(--cell-y) 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.is-selected { background: var(--brand-soft); }
.table tbody tr:last-child td { border-bottom: 0; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table .col-check { width: 44px; padding-right: 0; }
.table .col-actions { width: 1%; white-space: nowrap; text-align: right; }

.cell-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-main .thumb { flex: none; width: 56px; height: 40px; border-radius: var(--r-2); object-fit: cover; background: var(--surface-3); }
.cell-title { font-weight: 500; color: var(--text); }
.cell-sub { font-size: var(--fs-12); color: var(--text-3); }
.cell-wide { min-width: 200px; max-width: 320px; }

.table-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}
.table-bar .input-wrap { width: 260px; max-width: 100%; }
.table-bar .field-select { width: 150px; }
.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-3);
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-13);
  color: var(--text-3);
}

/* 批量操作条 */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px 20px;
  background: var(--brand-soft);
  border-bottom: 1px solid var(--brand-line);
  color: var(--brand-text);
  font-size: var(--fs-13);
  font-weight: 500;
}

/* 分页 */
.pager { display: inline-flex; align-items: center; gap: 2px; }
.pager button {
  min-width: 30px;
  height: 30px;
  padding: 0 7px;
  border-radius: var(--r-2);
  color: var(--text-2);
  font-size: var(--fs-13);
  font-variant-numeric: tabular-nums;
  transition: background var(--t-fast);
}
.pager button:hover:not([disabled]) { background: var(--surface-3); color: var(--text); }
.pager button.is-active { background: var(--brand); color: var(--brand-ink); font-weight: 600; }
.pager button[disabled] { color: var(--text-4); cursor: not-allowed; }
.pager .gap { width: 26px; text-align: center; color: var(--text-4); }

/* ---------- 标签页 ---------- */
.tabs { display: flex; gap: var(--sp-5); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button, .tabs a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 1px;
  color: var(--text-3);
  font-size: var(--fs-13);
  font-weight: 500;
  white-space: nowrap;
  transition: color var(--t-fast);
}
.tabs button:hover, .tabs a:hover { color: var(--text); }
.tabs .is-active { color: var(--text); }
.tabs .is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--brand);
}
.tab-panel { display: none; }
.tab-panel.is-active { display: block; animation: fade-up var(--t-base) var(--ease); }

@keyframes fade-up { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- 下拉菜单 ---------- */
.dropdown {
  position: fixed;
  z-index: 900;
  min-width: 180px;
  max-height: min(70vh, 480px);
  overflow: auto;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  background: var(--surface);
  box-shadow: var(--shadow-3);
  animation: pop var(--t-fast) var(--ease);
}
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(-3px); } to { opacity: 1; transform: none; } }
.menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 9px;
  border-radius: var(--r-2);
  color: var(--text);
  font-size: var(--fs-13);
  text-align: left;
  white-space: nowrap;
}
.menu-item > i { width: 15px; text-align: center; color: var(--text-3); font-size: 12px; }
.menu-item:hover { background: var(--surface-3); }
.menu-item.is-danger, .menu-item.is-danger > i { color: var(--danger-text); }
.menu-item.is-danger:hover { background: var(--danger-soft); }
.menu-sep { height: 1px; margin: 5px 4px; background: var(--line); }
.menu-label { padding: 6px 9px 4px; font-size: var(--fs-11); color: var(--text-3); }

/* ---------- 文字提示 ---------- */
.tooltip {
  position: fixed;
  z-index: 1200;
  max-width: 260px;
  padding: 5px 9px;
  border-radius: var(--r-2);
  background: #151922;
  color: #f1f3f6;
  font-size: var(--fs-12);
  line-height: 1.45;
  pointer-events: none;
  box-shadow: var(--shadow-2);
  animation: fade-in var(--t-fast);
}
[data-theme="dark"] .tooltip { background: #2a303b; }

/* ---------- 弹窗与抽屉 ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: var(--overlay);
  backdrop-filter: blur(2px);
  animation: fade-in var(--t-base);
}
.overlay.is-center { display: flex; align-items: center; justify-content: center; padding: var(--sp-4); }

.modal {
  display: flex;
  flex-direction: column;
  width: 520px;
  max-width: 100%;
  max-height: calc(100dvh - 48px);
  border: 1px solid var(--line);
  border-radius: var(--r-5);
  background: var(--surface);
  box-shadow: var(--shadow-4);
  animation: modal-in var(--t-base) var(--ease);
}
.modal.is-lg { width: 760px; }
.modal.is-sm { width: 420px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); padding: 18px 20px 6px; }
.modal-title { font-size: var(--fs-16); font-weight: 600; }
.modal-body { padding: 10px 20px 20px; overflow: auto; color: var(--text-2); }
.modal-foot { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: 14px 20px; border-top: 1px solid var(--line); }
.modal-close { color: var(--text-3); width: 28px; height: 28px; border-radius: var(--r-2); flex: none; }
.modal-close:hover { background: var(--surface-3); color: var(--text); }

.confirm-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-bottom: var(--sp-3);
  border-radius: 50%;
  background: var(--warning-soft);
  color: var(--warning-text);
}
.confirm-icon.is-danger { background: var(--danger-soft); color: var(--danger-text); }

.drawer {
  position: fixed;
  z-index: 810;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: 480px;
  max-width: 100vw;
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-4);
  animation: drawer-in var(--t-base) var(--ease);
}
@keyframes drawer-in { from { transform: translateX(100%); } to { transform: none; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer-body { flex: 1; overflow: auto; padding: 20px; }
.drawer-foot { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: 14px 20px; border-top: 1px solid var(--line); }

/* ---------- 消息提示 ---------- */
.toast-stack {
  position: fixed;
  z-index: 1100;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 90vw;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  background: var(--surface);
  box-shadow: var(--shadow-3);
  font-size: var(--fs-13);
  font-weight: 500;
  pointer-events: auto;
  animation: toast-in var(--t-base) var(--ease);
}
.toast.is-out { opacity: 0; transform: translateY(-6px); transition: all var(--t-base); }
.toast i { font-size: 14px; }
.toast.is-success i { color: var(--success); }
.toast.is-danger i { color: var(--danger); }
.toast.is-warning i { color: var(--warning); }
.toast.is-info i { color: var(--info); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* ---------- 警示条 ---------- */
.alert {
  display: flex;
  gap: 10px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  background: var(--surface-2);
  font-size: var(--fs-13);
}
.alert > i { margin-top: 3px; font-size: 13px; color: var(--text-3); }
.alert-title { font-weight: 600; color: var(--text); }
.alert.is-info { background: var(--info-soft); border-color: var(--info-line); }
.alert.is-info > i { color: var(--info); }
.alert.is-success { background: var(--success-soft); border-color: var(--success-line); }
.alert.is-success > i { color: var(--success); }
.alert.is-warning { background: var(--warning-soft); border-color: var(--warning-line); }
.alert.is-warning > i { color: var(--warning); }
.alert.is-danger { background: var(--danger-soft); border-color: var(--danger-line); }
.alert.is-danger > i { color: var(--danger); }

/* ---------- 进度 ---------- */
.progress { height: 6px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--brand); transition: width .5s var(--ease); }
.progress.is-success > span { background: var(--success); }
.progress.is-warning > span { background: var(--warning); }
.progress.is-danger > span { background: var(--danger); }

/* ---------- 步骤 ---------- */
.steps { display: flex; gap: var(--sp-3); }
.step { flex: 1; display: flex; align-items: center; gap: 9px; min-width: 0; font-size: var(--fs-13); color: var(--text-3); }
.step::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); }
.step:last-child { flex: none; }
.step:last-child::after { display: none; }
.step .dot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  font-size: var(--fs-12);
  font-weight: 600;
}
.step.is-done .dot { background: var(--brand-soft); border-color: transparent; color: var(--brand-text); }
.step.is-current { color: var(--text); font-weight: 500; }
.step.is-current .dot { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

/* ---------- 时间线 ---------- */
.timeline { display: flex; flex-direction: column; }
.timeline-item { position: relative; display: flex; gap: var(--sp-3); padding-bottom: var(--sp-4); }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: 13.5px;
  top: 30px;
  bottom: 2px;
  width: 1px;
  background: var(--line);
}
.timeline-item:last-child::before { display: none; }
.timeline-mark {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-3);
  font-size: 11px;
}
.timeline-mark.is-brand { background: var(--brand-soft-2); color: var(--brand-text); }
.timeline-mark.is-success { background: var(--success-soft); color: var(--success-text); }
.timeline-mark.is-warning { background: var(--warning-soft); color: var(--warning-text); }
.timeline-mark.is-danger { background: var(--danger-soft); color: var(--danger-text); }
.timeline-body { min-width: 0; font-size: var(--fs-13); padding-top: 3px; }
.timeline-time { font-size: var(--fs-12); color: var(--text-3); }

/* ---------- 描述列表 ---------- */
.desc { display: grid; grid-template-columns: 96px minmax(0, 1fr); row-gap: 10px; column-gap: var(--sp-3); font-size: var(--fs-13); }
.desc dt { color: var(--text-3); }
.desc dd { color: var(--text); min-width: 0; word-break: break-word; }

/* ---------- 列表 ---------- */
.list-item { display: flex; align-items: center; gap: var(--sp-3); padding: 11px 0; border-bottom: 1px solid var(--line); }
.list-item:first-child { padding-top: 0; }
.list-item:last-child { border-bottom: 0; padding-bottom: 0; }

/* ---------- 骨架与空状态 ---------- */
.skeleton {
  display: block;
  height: 14px;
  border-radius: var(--r-1);
  background: linear-gradient(100deg, var(--surface-3) 30%, var(--surface-2) 50%, var(--surface-3) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }

.empty { display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); padding: 44px 20px; text-align: center; }
.empty img { width: 112px; height: 112px; border-radius: var(--r-5); margin-bottom: var(--sp-2); object-fit: cover; }
.empty-title { font-weight: 600; }
.empty-desc { max-width: 340px; font-size: var(--fs-13); color: var(--text-3); }

/* ---------- 上传 ---------- */
.upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 26px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-3);
  background: var(--surface-2);
  color: var(--text-3);
  font-size: var(--fs-13);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.upload > i { font-size: 20px; margin-bottom: 4px; }
.upload:hover, .upload.is-over { border-color: var(--brand); background: var(--brand-soft); }
.upload-preview { position: relative; border-radius: var(--r-3); overflow: hidden; }
.upload-preview img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.upload-preview .btn { position: absolute; top: 8px; right: 8px; }

/* ---------- 折叠面板 ---------- */
.accordion { border: 1px solid var(--line); border-radius: var(--r-3); overflow: hidden; }
.accordion-item + .accordion-item { border-top: 1px solid var(--line); }
.accordion-head { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 11px 14px; font-size: var(--fs-13); font-weight: 500; text-align: left; }
.accordion-head:hover { background: var(--surface-2); }
.accordion-head i { font-size: 11px; color: var(--text-3); transition: transform var(--t-base) var(--ease); }
.accordion-item.is-open .accordion-head i { transform: rotate(180deg); }
.accordion-body { display: none; padding: 2px 14px 14px; font-size: var(--fs-13); color: var(--text-2); }
.accordion-item.is-open .accordion-body { display: block; }

/* ---------- 树 ---------- */
.tree { font-size: var(--fs-13); }
.tree-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border-radius: var(--r-2);
  color: var(--text-2);
  text-align: left;
}
.tree-item:hover { background: var(--surface-3); color: var(--text); }
.tree-item.is-active { background: var(--brand-soft); color: var(--brand-text); font-weight: 500; }
.tree-item i { width: 15px; text-align: center; font-size: 12px; color: var(--text-3); }
.tree-item.is-active i { color: inherit; }
.tree-item .count { margin-left: auto; }
.tree-group { padding-left: 16px; }

/* ---------- 命令面板 ---------- */
.palette {
  width: 600px;
  max-width: 100%;
  margin: 12vh auto 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-5);
  background: var(--surface);
  box-shadow: var(--shadow-4);
  animation: modal-in var(--t-base) var(--ease);
}
.palette-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.palette-input i { color: var(--text-3); }
.palette-input input { flex: 1; height: 52px; border: 0; outline: 0; background: none; font-size: var(--fs-16); }
.palette-list { max-height: 380px; overflow: auto; padding: 6px; }
.palette-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: var(--r-3); font-size: var(--fs-13); text-align: left; }
.palette-item > i { width: 16px; text-align: center; color: var(--text-3); }
.palette-item.is-active { background: var(--brand-soft); color: var(--brand-text); }
.palette-item.is-active > i { color: inherit; }
.palette-item .path { margin-left: auto; font-size: var(--fs-12); color: var(--text-3); }
.palette-foot { display: flex; gap: var(--sp-4); padding: 8px 16px; border-top: 1px solid var(--line); font-size: var(--fs-12); color: var(--text-3); }
.palette-foot span { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- 交互状态补充 ---------- */
/* 需要手动关闭的提示（失败、警告） */
.toast-close { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-left: 4px; border: 0; border-radius: var(--r-1); background: transparent; color: var(--text-3); cursor: pointer; }
.toast-close:hover { background: var(--surface-3); color: var(--text); }
.toast .toast-close i { font-size: 12px; color: inherit; }

/* 表格加载中与加载失败 */
.table-state { display: flex; align-items: center; justify-content: center; gap: var(--sp-3); padding: 44px 20px; font-size: var(--fs-13); color: var(--text-3); }
.table-state.is-error { color: var(--danger-text); }
.spinner { width: 14px; height: 14px; border: 2px solid var(--line-strong); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }

/* 恢复未保存内容的提示 */
.keep-alert { align-items: center; margin-bottom: var(--sp-4); }
.keep-alert .btn-link { flex-shrink: 0; }

/* 保存状态：未保存时在文字前显示圆点 */
.save-state { display: inline-flex; align-items: center; gap: 6px; }
.save-state.is-dirty::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--warning); }

/* 可点击的列表行 */
a.list-item { color: inherit; text-decoration: none; }
a.list-item:hover .grow { color: var(--brand-text); }
