:root {
  --bg: #f2f2ee;
  --panel: #fbfbf8;
  --panel-strong: #ffffff;
  --ink: #1b1b18;
  --ink-soft: #34342f;
  --muted: #74746b;
  --faint: #98988e;
  --line: #deded6;
  --line-strong: #c8c8bf;
  --accent: #275a4f;
  --accent-soft: #e5ede9;
  --danger: #a34338;
  --danger-soft: #f5e8e5;
  --ok: #2d684c;
  --ok-soft: #e5efe8;
  --warn: #876323;
  --warn-soft: #f2ecdc;
  --info: #3d5f7a;
  --info-soft: #e8eef3;
  --radius: 4px;
  --font-sans: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "SFMono-Regular", "JetBrains Mono", "IBM Plex Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 13px/1.55 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4, p { margin-top: 0; }
button, input, select, textarea { font: inherit; }
::selection { background: #cfddd6; }

.layout { display: flex; min-height: 100vh; }

/* Login gate */
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(circle at 50% 0%, rgba(39, 90, 79, .08), transparent 42%),
    var(--bg);
}
.auth-shell { width: min(460px, 100%); }
.auth-card {
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  box-shadow: 0 22px 70px rgba(27, 27, 24, .11);
  padding: 30px 32px 24px;
}
.auth-loading { min-height: 180px; display: grid; place-items: center; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.auth-brand > div { display: grid; gap: 1px; }
.auth-brand strong { font-size: 15px; letter-spacing: -.02em; }
.auth-brand small { color: var(--muted); font: 10px/1.2 var(--font-mono); letter-spacing: .14em; }
.auth-copy { margin-bottom: 22px; }
.auth-copy h1 { margin-bottom: 7px; font-size: 22px; letter-spacing: -.03em; }
.auth-copy p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.auth-form { display: flex; flex-direction: column; gap: 2px; }
.auth-form .field { margin-bottom: 14px; }
.auth-form button[type="submit"] { width: 100%; min-height: 38px; margin-top: 2px; }
.auth-message {
  min-height: 24px;
  padding: 3px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
  overflow-wrap: anywhere;
}
.auth-message.is-error { color: var(--danger); }
.auth-note {
  margin: 18px 0 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  background: #f6f6f1;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}
.auth-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 16px;
  color: var(--faint);
  font-size: 10px;
  letter-spacing: .06em;
}
.auth-foot .spacer { flex: 1; }
.auth-foot .mono { font-family: var(--font-mono); }
@media (max-width: 520px) {
  .auth-screen { padding: 18px 12px; }
  .auth-card { padding: 24px 20px 20px; }
}

/* Sidebar */
.sidebar {
  width: 218px;
  flex: 0 0 218px;
  background: #ecece7;
  border-right: 1px solid var(--line);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
  color: var(--ink);
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #f6f6f1;
  font: 700 13px/1 var(--font-mono);
  letter-spacing: -.04em;
}
.brand-copy { display: grid; gap: 1px; }
.brand-copy strong { font-size: 15px; letter-spacing: -.02em; }
.brand-copy small {
  color: var(--muted);
  font: 10px/1.2 var(--font-mono);
  letter-spacing: .14em;
}
.side-status {
  margin: 0 12px 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .32);
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font: 10px/1.3 var(--font-mono);
  letter-spacing: .08em;
}
.side-status .mono { margin-left: auto; color: var(--faint); }

.sidebar nav { display: flex; flex-direction: column; padding: 2px 10px; gap: 2px; overflow-y: auto; }
.nav-group { padding: 10px 0 5px; }
.nav-label {
  padding: 0 9px 4px;
  color: var(--faint);
  font: 10px/1.2 var(--font-mono);
  letter-spacing: .12em;
}
.sidebar nav a {
  color: var(--ink-soft);
  padding: 7px 9px;
  border-radius: 3px;
  text-decoration: none;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar nav a::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: transparent;
  flex: none;
}
.sidebar nav a:hover { background: #f7f7f2; border-color: var(--line); text-decoration: none; }
.sidebar nav a.active { background: var(--ink); border-color: var(--ink); color: #fafaf5; }
.sidebar nav a.active::before { background: #b5d2c5; }

.sidebar-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--line); }
.side-meta {
  display: flex;
  justify-content: space-between;
  color: var(--faint);
  font: 10px/1.3 var(--font-mono);
  margin-bottom: 8px;
}
.sidebar-foot .ghost {
  width: 100%;
  justify-content: center;
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink-soft);
}
.sidebar-foot .ghost:hover { background: var(--panel-strong); }

/* Content shell */
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 52px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(242, 242, 238, .92);
  position: sticky;
  top: 0;
  z-index: 20;
}
.crumb { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.crumb strong { color: var(--ink); font-weight: 600; }
.crumb .sep { color: var(--line-strong); }
.topbar-meta { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 11px; }
.clock { font-family: var(--font-mono); font-size: 11px; letter-spacing: .02em; }
.build-tag {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink-soft);
  font: 10px/1.4 var(--font-mono);
  letter-spacing: .04em;
  white-space: nowrap;
}
.live-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 10px/1 var(--font-mono);
  letter-spacing: .08em;
  color: var(--ok);
}
.pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(45, 104, 76, .35);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(45, 104, 76, .28); }
  50% { box-shadow: 0 0 0 4px rgba(45, 104, 76, 0); }
}

.page { width: 100%; max-width: 1480px; margin: 0 auto; padding: 26px 28px 70px; }

/* Page header */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}
.page-head-copy { min-width: 0; }
.eyebrow {
  color: var(--faint);
  font: 10px/1.2 var(--font-mono);
  letter-spacing: .12em;
  margin-bottom: 8px;
}
.page-head h1 { font-size: 23px; line-height: 1.2; font-weight: 650; letter-spacing: -.035em; margin: 0; }
.page-head p { margin: 6px 0 0; color: var(--muted); max-width: 880px; }
.page-actions, .panel-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.page-actions { flex: none; }

/* Layout helpers */
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.right { margin-left: auto; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.help { color: var(--muted); font-size: 12px; }
.mono { font-family: var(--font-mono); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Panels and cards */
.panel, .card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
}
.panel-title { min-width: 0; }
.panel-title h2 { margin: 0; font-size: 14px; font-weight: 650; letter-spacing: -.01em; display: inline-flex; align-items: center; gap: 8px; }
.panel-title p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.panel-count {
  display: inline-flex;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--muted);
  font: 10px/1 var(--font-mono);
}
.panel-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: #f7f7f3;
}
.panel-body { padding: 16px; }
.panel > .empty { margin: 0; border: 0; border-radius: 0; }
.panel-foot { margin: 0; padding: 10px 16px; border-top: 1px solid var(--line); }
.card { padding: 16px; }
.card > h2, .card > h3 { margin: 0 0 10px; font-size: 14px; font-weight: 650; }
.card .muted { color: var(--muted); }

.install-sep {
  height: 1px;
  margin: 16px 0 14px;
  background: var(--line);
}

/* Plugin upload dropzone */
.dropzone {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 26px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: #f7f7f3;
  text-align: center;
  cursor: pointer;
}
.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}
.dropzone.dragover {
  border-color: var(--accent);
  border-style: solid;
  background: var(--accent-soft);
}
.dropzone.busy {
  cursor: progress;
  opacity: .7;
}
.dropzone > * { pointer-events: none; }
.dropzone-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  background: var(--panel-strong);
  color: var(--muted);
  font: 600 10px/1 var(--font-mono);
  letter-spacing: .08em;
}
.dropzone-title { font-weight: 600; }
.install-status { margin-top: 8px; color: var(--muted); font-size: 12px; }

.stat { font: 600 25px/1.2 var(--font-mono); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 11px; }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; width: 100%; }
.toolbar > input,
.toolbar > select { width: auto; flex: 1 1 160px; min-width: 130px; max-width: 260px; }
.toolbar > input[type="checkbox"] { flex: none; width: 14px; min-width: 0; }
.toolbar > label,
.toolbar > button { flex: none; }
.toolbar .spacer { flex: 1; min-width: 8px; }
.panel-tools > input,
.panel-tools > select { width: auto; min-width: 150px; }

/* Form controls */
button, .btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--panel-strong);
  color: var(--ink);
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
}
button:hover, .btn:hover { border-color: var(--ink-soft); text-decoration: none; }
button.primary, .btn.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #fafaf5;
}
button.primary:hover { background: #31312c; border-color: #31312c; }
button.danger { color: var(--danger); border-color: #d8b5ae; background: var(--panel-strong); }
button.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover { background: #efefe9; color: var(--ink); border-color: var(--line); }
button.small, .btn.small { min-height: 26px; padding: 3px 8px; font-size: 11px; }
button.icon-btn { min-width: 28px; padding: 0 6px; font-size: 18px; line-height: 1; }
button:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

input, select, textarea {
  font: inherit;
  color: var(--ink);
  background: var(--panel-strong);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  min-height: 31px;
  padding: 5px 8px;
  width: 100%;
}
select { padding-right: 26px; }
textarea { min-height: 110px; resize: vertical; font-family: var(--font-mono); font-size: 12px; }
input[type="checkbox"] { width: 14px; height: 14px; min-height: 0; padding: 0; accent-color: var(--accent); }
input[type="file"] { padding: 4px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; min-width: 0; }
.field > span:first-child { font-size: 12px; color: var(--ink-soft); }
.field .help { font-size: 11px; }
/* 结构化参数：分组、对象数组卡片、多选标签 */
.param-group { border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px 2px; }
.param-group-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.param-group-head > span:first-child { font-size: 12px; color: var(--ink-soft); }
.param-item { border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px 2px; background: var(--panel-strong); }
.param-item-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.param-item-title { font-size: 12px; font-weight: 600; color: var(--ink-soft); word-break: break-all; }
.param-options { display: flex; flex-wrap: wrap; gap: 10px; }
.param-options .check { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.param-chips { gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 2px; padding: 1px 2px 1px 8px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--panel-strong); font-size: 11px; }
.chip.bad { border-color: var(--danger); color: var(--danger); }
.chip .icon-btn { min-height: 0; padding: 0 4px; }
form.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.form-grid { display: grid; gap: 12px; }

/* Badges, dots, progress */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  border-radius: 2px;
  border: 1px solid var(--line);
  background: #f1f1ec;
  color: #5f5f57;
  font-size: 11px;
  line-height: 1.55;
  white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); border-color: #cbded2; color: var(--ok); }
.badge.warn { background: var(--warn-soft); border-color: #e3d5ae; color: var(--warn); }
.badge.bad { background: var(--danger-soft); border-color: #e4c6c0; color: var(--danger); }
.badge.info { background: var(--info-soft); border-color: #ccdae4; color: var(--info); }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--danger); }
.dot.info { background: var(--info); }
.progress { height: 5px; background: #e7e7e1; overflow: hidden; border-radius: 1px; width: 100%; }
.progress > span { display: block; height: 100%; background: var(--accent); }
.progress.ok > span { background: var(--ok); }
.progress.warn > span { background: var(--warn); }
.progress.bad > span { background: var(--danger); }

/* Tables */
.scroll-x { overflow-x: auto; max-width: 100%; }
.data-table table, .scroll-x table, table.mini {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
  font-variant-numeric: tabular-nums;
}
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  background: #f6f6f1;
  white-space: nowrap;
}
tbody tr:hover { background: #f7f7f2; }
tbody tr.is-selected { background: #e9f0ec; }
tbody tr:last-child td { border-bottom: 0; }
td.actions { white-space: nowrap; }
td.actions button { padding: 3px 7px; font-size: 11px; }
td.actions .row { flex-wrap: nowrap; gap: 4px; }
.select-col { width: 30px; padding-right: 4px; text-align: center; }
.select-col input { vertical-align: middle; }
.data-table .empty { border: 0; border-radius: 0; }
.batch-bar {
  display: none;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  background: #f6f6f1;
}
.batch-bar.is-active { display: flex; background: var(--accent-soft); border-color: #cddbd4; }
.batch-info { font: 10px/1.3 var(--font-mono); color: var(--accent); letter-spacing: .04em; }
.table-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.pager { display: flex; align-items: center; gap: 8px; }
.pager-size { width: auto; min-width: 92px; padding: 3px 6px; font-size: 11px; }
table.mini th, table.mini td { padding: 4px 6px; }
table.mini tbody tr:hover { background: transparent; }

/* Empty and errors */
.empty {
  padding: 36px 18px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: #fafaf6;
}
.empty.loading { color: var(--faint); }
.error-box {
  padding: 11px 13px;
  border: 1px solid #e4c6c0;
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: var(--radius);
}

/* Dialog */
dialog {
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 0;
  width: min(560px, calc(100vw - 32px));
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 22px 70px rgba(27, 27, 24, .2);
}
dialog::backdrop { background: rgba(27, 27, 24, .36); }
dialog .dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}
dialog .dialog-head h2 { margin: 0; font-size: 14px; font-weight: 650; }
dialog .dialog-body { padding: 16px; max-height: 72vh; overflow: auto; }
dialog .dialog-foot {
  padding: 11px 16px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: #f7f7f3;
}
.dialog-text { margin: 0; color: var(--ink-soft); overflow-wrap: anywhere; }

/* Toasts */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; }
.toast {
  background: var(--ink);
  color: #fafaf5;
  padding: 9px 12px;
  border-radius: 3px;
  max-width: 420px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .18);
  font-size: 12px;
}
.toast.error { background: #7a3028; }

/* Logs */
.logbox {
  background: #171916;
  color: #d8e3d9;
  border-radius: 3px;
  padding: 11px 12px;
  height: 440px;
  overflow: auto;
  font: 12px/1.6 var(--font-mono);
}
.logline { white-space: pre-wrap; word-break: break-word; }
.logline .lvl-warn { color: #e2bf6f; }
.logline .lvl-error { color: #e9a198; }
.logline .lvl-debug { color: #8f9f92; }

/* Hover preview kept from the account page */
.hover-preview { position: relative; display: inline-flex; }
.hover-preview-panel {
  display: none;
  position: fixed;
  z-index: 50;
  width: 300px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--panel-strong);
  box-shadow: 0 14px 40px rgba(27, 27, 24, .16);
}
.hover-preview-panel.open { display: block; }
.hover-preview-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; }

/* Dashboard */
.dashboard { display: flex; flex-direction: column; gap: 16px; }
.dashboard-live { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.dashboard-live .mono { color: var(--faint); }
.auto-select {
  min-height: 28px;
  width: auto;
  padding: 3px 24px 3px 8px;
  font-size: 11px;
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}
.ops-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border: 1px solid var(--line);
  background: var(--panel);
}
.ops-item { padding: 12px 14px; border-right: 1px solid var(--line); min-width: 0; }
.ops-item:last-child { border-right: 0; }
.ops-label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.ops-value { margin-top: 4px; font: 600 21px/1.2 var(--font-mono); letter-spacing: -.04em; }
.ops-sub { margin-top: 2px; color: var(--faint); font-size: 11px; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, .9fr); gap: 16px; }
.dash-grid.equal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.metric-list { display: flex; flex-direction: column; }
.metric-row {
  display: grid;
  grid-template-columns: minmax(140px, .85fr) minmax(120px, 1fr) 52px;
  gap: 14px;
  align-items: center;
  padding: 11px 16px;
}
.metric-row + .metric-row { border-top: 1px solid var(--line); }
.metric-title { min-width: 0; }
.metric-title strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.metric-title span {
  display: block;
  color: var(--faint);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.metric-title .metric-label {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.metric-body { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.metric-foot {
  color: var(--faint);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.metric-pct { text-align: right; font: 11px var(--font-mono); color: var(--muted); }
.host-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: #f7f7f2;
}
.host-meta-item { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.host-meta-item span { color: var(--faint); font-size: 11px; }
.host-meta-item strong { font: 600 11px var(--font-mono); color: var(--ink-soft); }
.metric-notice { padding: 8px 16px; color: var(--warn); font-size: 11px; border-top: 1px solid var(--line); }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); }
.stat-grid > div { background: var(--panel); padding: 10px 12px; min-width: 0; }
.stat-grid strong {
  display: block;
  font: 600 15px/1.25 var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stat-grid span { color: var(--muted); font-size: 11px; }
.health-list { display: flex; flex-direction: column; }
.health-row {
  display: grid;
  grid-template-columns: 18px minmax(110px, 1.1fr) minmax(110px, 1fr) 56px;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
}
.health-row:last-child { border-bottom: 0; }
.health-mark { display: flex; justify-content: center; }
.health-title { min-width: 0; }
.health-title strong { display: block; font-weight: 600; }
.health-title span { color: var(--faint); font-size: 11px; }
.health-bar { min-width: 80px; }
.health-percent { text-align: right; color: var(--muted); font: 11px var(--font-mono); }
.alert-list { display: flex; flex-direction: column; }
.alert-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}
.alert-row:last-child { border-bottom: 0; }
.alert-row:hover { background: #f7f7f2; text-decoration: none; }
.alert-copy { min-width: 0; flex: 1; }
.alert-copy strong { display: block; font-weight: 600; font-size: 12px; }
.alert-copy span { color: var(--muted); font-size: 11px; }
.alert-value { margin-left: auto; font: 600 15px/1.2 var(--font-mono); color: var(--muted); }
.run-mini-list { display: flex; flex-direction: column; }
.run-mini {
  display: block;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}
.run-mini:last-child { border-bottom: 0; }
.run-mini:hover { background: #f7f7f2; text-decoration: none; }
.run-mini-head { display: flex; align-items: center; gap: 8px; }
.run-mini-id { font: 11px var(--font-mono); color: var(--muted); }
.run-mini-type { font-weight: 600; font-size: 12px; }
.run-mini-meta { margin-left: auto; color: var(--faint); font-size: 11px; }
.run-mini-sub { display: flex; justify-content: space-between; gap: 8px; margin: 3px 0 6px; color: var(--muted); font-size: 11px; }
.activity { display: flex; flex-direction: column; }
.activity-row {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  gap: 10px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}
.activity-row:last-child { border-bottom: 0; }
.activity-row time { color: var(--faint); font-family: var(--font-mono); }
.activity-row .msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-soft); }
.activity-row .lvl { font: 10px var(--font-mono); color: var(--muted); }
.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border-top: 1px solid var(--line); }
.quick-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 16px;
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
  font-size: 12px;
}
.quick-link:hover { background: var(--panel-strong); text-decoration: none; }
.quick-link span { color: var(--faint); font: 10px var(--font-mono); }
.plugin-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); }
.plugin-summary > div { background: var(--panel); padding: 10px 12px; }
.plugin-summary strong { display: block; font: 600 16px/1.2 var(--font-mono); }
.plugin-summary span { color: var(--muted); font-size: 11px; }

/* Responsive */
@media (max-width: 1200px) {
  .ops-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ops-item:nth-child(3) { border-right: 0; }
  .ops-item:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 12px 14px 8px; }
  .side-status { display: none; }
  .sidebar nav { flex-direction: row; overflow-x: auto; padding: 0 8px 8px; gap: 2px; }
  .nav-group { display: contents; }
  .nav-label { display: none; }
  .sidebar nav a { white-space: nowrap; }
  .sidebar nav a::before { display: none; }
  .sidebar-foot {
    display: flex;
    justify-content: flex-end;
    padding: 0 12px 8px;
    border-top: 0;
  }
  .side-meta { display: none; }
  .sidebar-foot .ghost { width: auto; padding: 4px 10px; }
  .topbar { padding: 0 18px; }
  .page { padding: 20px 18px 60px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .dash-grid.equal { grid-template-columns: 1fr; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .page-actions { width: 100%; }
  .health-row { grid-template-columns: 18px minmax(90px, 1fr) minmax(80px, 1fr) 48px; }
}
@media (max-width: 620px) {
  .ops-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ops-item:nth-child(3) { border-right: 1px solid var(--line); }
  .ops-item:nth-child(2n) { border-right: 0; }
  .ops-item:nth-child(-n+4) { border-bottom: 1px solid var(--line); }
  .topbar-meta .live-tag { display: none; }
  .clock { display: none; }
  .topbar-meta { gap: 8px; }
  .build-tag { max-width: 44vw; overflow: hidden; text-overflow: ellipsis; }
  .health-row { grid-template-columns: 16px 1fr 52px; }
  .health-bar { display: none; }
  .plugin-summary { grid-template-columns: 1fr; }
}

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); }
.tab {
  border: 1px solid transparent;
  border-bottom: 0;
  background: transparent;
  border-radius: 3px 3px 0 0;
  color: var(--muted);
  min-height: 34px;
  padding: 6px 14px;
}
.tab:hover { color: var(--ink); background: #efefe9; border-color: transparent; }
.tab.active { background: var(--panel); border-color: var(--line); color: var(--ink); font-weight: 600; }

.check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 22px;
  font-size: 12px;
  line-height: 18px;
  color: var(--ink-soft);
  cursor: pointer;
}
.check input[type="checkbox"] { flex: none; width: 14px; height: 14px; min-height: 0; margin: 2px 0 0; }
.check:hover { color: var(--ink); }
.check-label { min-width: 0; }

/* Settings forms：统一的表单栅格与操作条，避免按钮 / 面板在操作时改变尺寸 */
.settings-stack { display: flex; flex-direction: column; gap: 18px; }
.form-body { padding: 18px 20px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 22px;
}
.form-grid .field { margin-bottom: 0; }
.form-grid .field.wide { grid-column: 1 / -1; }
.form-section { display: flex; flex-direction: column; gap: 10px; }
.form-section + .form-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.section-label {
  font: 600 10px/1.4 var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
}
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-static {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f5f5f0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 18px;
}
.chip-static::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 22px; }
.check-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 2px 2px 0;
}
.form-actions button { min-width: 112px; }
.form-actions .status {
  flex: 1 1 220px;
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.panel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}
.panel-actions .refresh-note {
  min-width: 52px;
  text-align: right;
  font-size: 11px;
  line-height: 1;
  color: var(--faint);
}
.table-slot { min-height: 92px; }
.wrap-any { word-break: break-word; }
@media (max-width: 900px) {
  .form-grid, .check-grid, .check-grid.cols-3 { grid-template-columns: 1fr; }
  .form-body { padding: 14px 16px; }
}

/* Restore overlay */
.restore-overlay {
  position: fixed;
  inset: 0;
  background: rgba(27, 27, 24, .55);
  display: grid;
  place-items: center;
  z-index: 1000;
}
.restore-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 22px 26px;
  width: min(440px, 90vw);
}
.restore-card strong { display: block; font-size: 15px; margin-bottom: 6px; }
.restore-bar { height: 4px; background: var(--line); overflow: hidden; margin-top: 14px; }
.restore-bar span {
  display: block;
  width: 40%;
  height: 100%;
  background: var(--accent);
  animation: restore-slide 1.4s ease-in-out infinite;
}
@keyframes restore-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

/* account-dock 增量样式 */
.steps { margin: 6px 0 0; padding-left: 20px; color: var(--ink-soft); display: grid; gap: 5px; }
.kv-list { display: grid; gap: 0; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .field.full { grid-column: 1 / -1; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar .spacer { flex: 1; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line-strong); background: var(--panel); border-radius: 999px; padding: 2px 9px; font-size: 11px; color: var(--ink-soft); }
.chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.mono-sm { font: 11px var(--font-mono); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 900px) { .grid-2, .grid-3, .form-grid { grid-template-columns: 1fr; } }
.drawer-body { display: grid; gap: 12px; }
.code-block { background: #f4f4ef; border: 1px solid var(--line); border-radius: 4px; padding: 8px 10px; font: 11px/1.6 var(--font-mono); overflow-x: auto; white-space: pre-wrap; word-break: break-all; }

/* ---------- account-dock 视觉一致性基线（第三轮 UI 审查） ---------- */

/* 面板内容统一内边距；表格页面也使用同一基线，避免内容贴边。 */
.panel-body { padding: 14px 16px 16px; min-width: 0; }
.panel-body > .toolbar:not(:last-child) { margin-bottom: 10px; }
.panel-body > .toolbar + .toolbar,
.panel-body > .toolbar + .chip-row { margin-top: -2px; }
.panel-body > .chip-row { margin-bottom: 8px; }
.panel-body > .toolbar:last-child { margin-bottom: 0; }
.panel-body > .pager-bar { margin-top: 10px; }
.pager-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }

/* 弹窗内的分组小标题：替代重复的内联 panel-head 覆盖。 */
.subhead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0 0;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.subhead h2 { margin: 0; font-size: 13px; font-weight: 650; letter-spacing: -.01em; }
.subhead p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.subhead.gap { margin-top: 10px; }

/* 徽章语义别名：页面统一使用 ok/warn/info/danger/muted。 */
.badge.danger { background: var(--danger-soft); border-color: #e4c6c0; color: var(--danger); }
.badge.muted { background: #efefe9; border-color: var(--line); color: var(--muted); }
.dot.danger { background: var(--danger); }
.dot.muted { background: var(--faint); }

/* 筛选标签与筛选行。 */
.filter-label { color: var(--muted); font-size: 12px; min-width: 44px; }
.filter-rows { display: grid; gap: 6px; margin-bottom: 10px; }
.filter-rows .chip-row { margin: 0; }

/* 数字列右对齐，保持表格纵向对齐。 */
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* 弹窗宽度档位，统一响应式上限。 */
dialog.dialog-sm { width: min(560px, calc(100vw - 32px)); }
dialog.dialog-md { width: min(720px, calc(100vw - 32px)); }
dialog.dialog-lg { width: min(880px, calc(100vw - 32px)); }

/* 滚动列表容器（消费记录、导出等）。 */
.list-box {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-strong);
  padding: 0 10px;
  max-height: 320px;
  overflow: auto;
}
.list-box .kv:last-child { border-bottom: 0; }

/* 图表容器统一高度。 */
.chart { height: 240px; }
.chart.tall { height: 280px; }

/* 表单在抽屉/弹窗中由 grid 间距统一控制，去掉字段自带的 margin。 */
.drawer-body .field { margin-bottom: 0; }
.drawer-body > .toolbar { gap: 8px 10px; }

/* 统计卡片支持四列，并适配窄屏。 */
.stat-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1120px) { .stat-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .stat-grid.cols-4 { grid-template-columns: 1fr; } }
.stat-grid > div > .muted { margin-top: 2px; }

/* 统一网格间距。 */
.grid-2, .grid-3 { gap: 14px; }

/* 窄屏页面留白与页头布局。 */
@media (max-width: 960px) {
  .page { padding: 18px 16px 56px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .page-actions { width: 100%; }
}

/* 按钮型标签与普通按钮的视觉统一 */
button.chip {
  min-height: 24px;
  padding: 2px 9px;
  font-weight: 400;
  color: var(--ink-soft);
  background: var(--panel-strong);
}
button.chip:hover { border-color: var(--ink-soft); background: var(--panel-strong); }
button.chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* 工具栏中的字段横向排列，避免标签把按钮挤到底部 */
.toolbar > .field { flex: 1 1 200px; margin-bottom: 0; }
.toolbar > .field > span:first-child { font-size: 11px; }

/* 键值行长文本折行，避免撑破弹窗 */
.kv span { min-width: 0; overflow-wrap: anywhere; }
.kv strong { text-align: right; font-weight: 600; }

/* 面板底部仅放分页时保持紧凑 */
.panel-body > .pager-bar { padding-top: 2px; }

/* 筛选工具条可以包含多行（工具栏 + 标签筛选） */
.panel-tools-stack { display: grid; gap: 8px; width: 100%; min-width: 0; }
.panel-tools-stack .toolbar { margin: 0; }
.panel-tools-stack .chip-row { margin: 0; }
.table-foot > .pager { margin-left: auto; flex-wrap: wrap; }

/* 表格面板为空/加载时保留与面板一致的留白 */
.panel > div > .empty:only-child { margin: 16px; }

/* 页面内多个区块之间的统一纵向节奏 */
#app.page > * + * { margin-top: 14px; }

/* 图表面板在同行内保持等高留白 */
.grid-2 > .panel { display: flex; flex-direction: column; }
.grid-2 > .panel > .panel-body { flex: 1; }

/* 空分页条在加载/无数据时不占位 */
.table-foot:has(> .pager:empty) { display: none; }
