/* ---------- 按钮 ---------- */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--ink);
  --btn-bd: var(--line);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 36px; padding: 0 13px;
  font-size: 13px; font-weight: 560; letter-spacing: -.005em;
  color: var(--btn-fg); background: var(--btn-bg);
  border: 1px solid var(--btn-bd); border-radius: var(--r-sm);
  cursor: pointer; white-space: nowrap; user-select: none;
  transition: background .14s, border-color .14s, color .14s, transform .08s, box-shadow .14s;
  text-decoration: none;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-strong); text-decoration: none; }
.btn:active { transform: translateY(.5px); }
.btn[disabled], .btn.is-disabled {
  opacity: .5; cursor: not-allowed; pointer-events: none;
}
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: var(--r-xs); }
.btn-lg { min-height: 42px; padding: 0 18px; font-size: 14px; border-radius: var(--r-md); }
.btn-icon { min-height: 34px; width: 34px; padding: 0; }
.btn-icon.btn-sm { min-height: 28px; width: 28px; }

.btn-primary {
  --btn-bg: linear-gradient(160deg, var(--brand) 0%, var(--brand-2) 120%);
  --btn-fg: #fff; --btn-bd: transparent;
  box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--brand) 72%, transparent), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.btn-primary:hover { --btn-bg: linear-gradient(160deg, color-mix(in srgb, var(--brand) 88%, #fff) 0%, var(--brand-2) 120%); }
.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-soft { --btn-bg: var(--brand-soft); --btn-fg: var(--brand-ink); --btn-bd: color-mix(in srgb, var(--brand) 22%, transparent); }
.btn-soft:hover { --btn-bg: var(--brand-soft-2); }
.btn-danger { --btn-bg: var(--danger-soft); --btn-fg: var(--danger); --btn-bd: color-mix(in srgb, var(--danger) 26%, transparent); }
.btn-danger:hover { --btn-bg: color-mix(in srgb, var(--danger) 14%, var(--surface)); }
.btn-quiet { --btn-bg: var(--surface-2); --btn-bd: var(--line); color: var(--muted); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
  min-width: 0;
  position: relative;
}
.card-flush { box-shadow: none; }
.card-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.card-head.is-plain { border-bottom: 0; padding-bottom: 4px; }
.card-title { font-size: 14px; font-weight: 640; letter-spacing: -.01em; display: flex; align-items: center; gap: 7px; }
.card-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.card-tools { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-body { padding: 16px; }
.card-body.tight { padding: 12px; }
.card-foot {
  padding: 12px 16px; border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px; background: var(--surface-2);
  border-radius: 0 0 var(--r-md) var(--r-md);
}

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
}
.field-label .req { color: var(--danger); font-weight: 700; }
.field-hint { font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.field-hint.is-warn { color: var(--warn); }
.field-hint.is-bad { color: var(--danger); }

.input, .select, .textarea {
  width: 100%;
  min-height: 36px;
  padding: 8px 11px;
  font-family: inherit; font-size: 13px; color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: border-color .14s, background .14s, box-shadow .14s;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-strong); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; background: var(--surface);
  border-color: color-mix(in srgb, var(--brand) 55%, var(--line));
  box-shadow: var(--ring);
}
.input.is-mono, .textarea.is-mono { font-family: var(--mono); font-size: 12.5px; }
.textarea { min-height: 84px; resize: vertical; line-height: 1.55; }
.select { appearance: none; padding-right: 30px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.select option { background: var(--surface); color: var(--ink); }

.input-group { display: flex; gap: 6px; }
.input-group .input { flex: 1 1 auto; }
.input-group .btn { flex: none; }

.checkline { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.checkline input { margin: 3px 0 0; accent-color: var(--brand); width: 15px; height: 15px; }

.seg {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--surface-3); border: 1px solid var(--line); border-radius: var(--r-sm);
  max-width: 100%; flex-wrap: nowrap; overflow: auto;
}
.seg button {
  border: 0; background: transparent; color: var(--muted);
  padding: 5px 10px; border-radius: var(--r-xs); cursor: pointer;
  font-size: 12.5px; font-weight: 540; white-space: nowrap;
  transition: background .14s, color .14s;
}
.seg button:hover { color: var(--ink); }
.seg button.is-on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-xs); font-weight: 600; }

/* ---------- 徽标 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; min-height: 20px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
  border-radius: var(--r-pill);
  background: var(--surface-3); color: var(--muted);
  border: 1px solid transparent; white-space: nowrap;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-brand { background: var(--brand-soft); color: var(--brand-ink); }
.badge-violet { background: var(--violet-soft); color: var(--violet); }
.badge-line { background: transparent; border-color: var(--line-strong); color: var(--muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.dot-pulse { animation: dot-pulse 1.4s ease-in-out infinite; }
@keyframes dot-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.82); } }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px; font-size: 12px; color: var(--ink-2);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-pill);
  max-width: 100%;
}
.chip .u-clip { max-width: 22ch; }
.chip-x { cursor: pointer; color: var(--faint); background: none; border: 0; padding: 0 1px; font-size: 14px; line-height: 1; }
.chip-x:hover { color: var(--danger); }

.kv { display: flex; align-items: baseline; gap: 6px; font-size: 12.5px; }
.kv-k { color: var(--muted); }

/* ---------- 统计块 ---------- */
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 13px 15px; display: flex; flex-direction: column; gap: 3px; min-width: 0;
}
.stat-k { font-size: 11.5px; color: var(--muted); font-weight: 560; letter-spacing: .02em; display: flex; align-items: center; gap: 6px; }
.stat-v { font-size: 23px; font-weight: 660; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.25; }
.stat-v small { font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.stat-sub { font-size: 11.5px; color: var(--faint); }
.stat-accent { color: var(--brand); }

/* ---------- 进度步骤 ---------- */
.steps { display: flex; flex-direction: column; gap: 0; }
.step {
  display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px;
  padding: 8px 0; position: relative;
}
.step::before {
  content: ""; position: absolute; left: 12.5px; top: 24px; bottom: -2px; width: 1px; background: var(--line);
}
.step:last-child::before { display: none; }
.step-num {
  width: 25px; height: 25px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700; font-family: var(--mono);
  background: var(--surface-3); color: var(--muted); border: 1px solid var(--line);
  position: relative; z-index: 1; transition: all .2s;
}
.step.is-run .step-num { background: var(--brand); color: #fff; border-color: transparent; box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent); }
.step.is-done .step-num { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 32%, transparent); }
.step.is-bad .step-num { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 32%, transparent); }
.step-title { font-size: 13px; font-weight: 580; color: var(--ink-2); line-height: 1.35; }
.step.is-run .step-title, .step.is-done .step-title { color: var(--ink); }
.step-sub { font-size: 11.5px; color: var(--muted); line-height: 1.5; margin-top: 1px; }

/* ---------- 进度条 / 环形 ---------- */
.bar { height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.bar > i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  border-radius: 99px; transition: width .35s ease;
}
.bar.is-ok > i { background: linear-gradient(90deg, var(--ok), #4ade9b); }
.bar.is-warn > i { background: linear-gradient(90deg, var(--warn), #f6c46a); }
.bar.is-bad > i { background: linear-gradient(90deg, var(--danger), #f0808a); }

.ring { position: relative; width: 112px; height: 112px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring-track { stroke: var(--surface-3); }
.ring-val { stroke: url(#ringGrad); transition: stroke-dashoffset .7s cubic-bezier(.16, 1, .3, 1); stroke-linecap: round; }
.ring-mid { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 0; }
.ring-score { font-size: 27px; font-weight: 700; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.ring-cap { font-size: 10.5px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; margin-top: 4px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--r-md); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
.tbl th {
  text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .03em;
  color: var(--muted); padding: 9px 12px; background: var(--surface-2);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr.is-sel { background: var(--brand-soft); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- 空状态 ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 34px 20px; text-align: center; color: var(--muted);
}
.empty-ico {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface-3); color: var(--faint); margin-bottom: 2px;
}
.empty-title { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.empty-sub { font-size: 12.5px; max-width: 42ch; line-height: 1.55; }

/* ---------- 代码 / 证据 ---------- */
.code {
  font-family: var(--mono); font-size: 12px; line-height: 1.6;
  background: var(--surface-3); color: var(--ink-2);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 10px 12px; overflow: auto; max-height: 260px; white-space: pre-wrap; word-break: break-word;
}
.code-lg { max-height: 420px; }

/* ---------- 提示条 ---------- */
.note {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 10px 12px; border-radius: var(--r-sm);
  font-size: 12.5px; line-height: 1.55;
  background: var(--info-soft); color: color-mix(in srgb, var(--info) 82%, var(--ink));
  border: 1px solid color-mix(in srgb, var(--info) 18%, transparent);
}
.note-warn { background: var(--warn-soft); color: color-mix(in srgb, var(--warn) 86%, var(--ink)); border-color: color-mix(in srgb, var(--warn) 22%, transparent); }
.note-bad { background: var(--danger-soft); color: color-mix(in srgb, var(--danger) 84%, var(--ink)); border-color: color-mix(in srgb, var(--danger) 22%, transparent); }
.note-ok { background: var(--ok-soft); color: color-mix(in srgb, var(--ok) 82%, var(--ink)); border-color: color-mix(in srgb, var(--ok) 22%, transparent); }
.note strong { font-weight: 660; }

/* ---------- 模态 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center; padding: 20px;
  background: var(--overlay); backdrop-filter: blur(3px);
  animation: fade .16s ease both;
}
.modal.hidden { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal-panel {
  width: min(660px, 100%); max-height: min(86vh, 860px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  animation: pop .18s cubic-bezier(.16, 1, .3, 1) both;
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-panel.is-wide { width: min(900px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 15.5px; }
.modal-body { padding: 16px 18px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* ---------- 吐司 ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 120; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 36px)); }
.toast {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 11px 13px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-md); font-size: 13px; color: var(--ink-2);
  animation: toast-in .2s ease both;
}
.toast.is-out { animation: toast-out .18s ease both; }
.toast-ico { margin-top: 1px; }
.toast-ok .toast-ico { color: var(--ok); }
.toast-bad .toast-ico { color: var(--danger); }
.toast-warn .toast-ico { color: var(--warn); }
.toast-info .toast-ico { color: var(--info); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

/* ---------- 折叠 ---------- */
details.disclosure { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); }
details.disclosure > summary {
  cursor: pointer; padding: 9px 12px; font-size: 12.5px; font-weight: 560; color: var(--ink-2);
  list-style: none; display: flex; align-items: center; gap: 7px;
}
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before { content: "▸"; color: var(--faint); font-size: 10px; transition: transform .15s; }
details.disclosure[open] > summary::before { transform: rotate(90deg); }
details.disclosure > .disclosure-body { padding: 0 12px 12px; }

/* ---------- 开关 ---------- */
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  width: 36px; height: 20px; border-radius: 99px; background: var(--line-strong);
  transition: background .16s; position: relative; flex: none;
}
.switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  background: #fff; border-radius: 50%; transition: transform .16s; box-shadow: var(--shadow-xs);
}
.switch input:checked + .switch-track { background: var(--brand); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { box-shadow: var(--ring); }

/* ---------- 骨架 ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: var(--r-xs);
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- 提示气泡 ---------- */
.tip { position: relative; display: inline-flex; }
.tip-btn {
  width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--muted); font-size: 10px; font-weight: 700;
  display: grid; place-items: center; cursor: help; line-height: 1; padding: 0;
}
.tip-body {
  position: absolute; bottom: calc(100% + 7px); left: 50%; transform: translateX(-50%);
  width: max-content; max-width: 250px; padding: 8px 10px;
  background: var(--ink); color: var(--bg); font-size: 11.5px; font-weight: 450; line-height: 1.5;
  border-radius: var(--r-xs); box-shadow: var(--shadow-md);
  opacity: 0; pointer-events: none; transition: opacity .14s; z-index: 40; text-align: left;
}
.tip:hover .tip-body, .tip:focus-within .tip-body { opacity: 1; }

/* ---------- 页面切换动效工具 ---------- */
.fade-in { animation: fade .2s ease both; }

/* ---- ²¹³䣺״̬µãÑÕɫ / ͷÏñ / ×ֺŹ¤¾ß ---- */
.dot-ok { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent); }
.dot-warn { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 18%, transparent); }
.dot-bad { background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 18%, transparent); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--brand-soft); color: var(--brand); font-weight: 650; font-size: 13px; }
