/* ==========================================================================
   Relay 控制台 · 工控台视觉系统（Ops Console）

   设计约束：
   - 近黑石墨底 + 单一信号色（琥珀），状态色只用于状态。
   - 直角化：3px 圆角，细线分隔，阴影只给浮层。
   - 等宽字体承载 ID、指标、时间与键值，正文用 IBM Plex Sans。
   - 结构优先：表格式排布、发丝线、极窄状态条。
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #ebeDE8;
  --panel: #ffffff;
  --panel-2: #f5f7f3;
  --line: #d7dbd5;
  --line-strong: #bcc3bb;
  --text: #0f1413;
  --muted: #5f6a66;
  --primary: #a2570f;
  --primary-hover: #87470c;
  --primary-soft: #f7ead8;
  --on-primary: #fffaf2;
  --ok: #147a4d;
  --warn: #93650a;
  --err: #b0231b;
  --info: #2456c8;
  --chart-1: #d9a441;
  --chart-2: #b8762a;
  --chart-3: #8c5a1e;
  --chart-4: #5e6b52;
  --chart-5: #3f4a44;
  --sidebar: #f7f6f1;
  --sidebar-fg: #333c39;
  --sidebar-muted: #75807b;
  --sidebar-accent: #eceae1;
  --sidebar-active: #e7e3d6;
  --sidebar-active-fg: #171d1b;
  --sidebar-line: #dad7cc;
  --sidebar-input: #fffefa;
  --sidebar-scroll: #c9cec6;
  --sidebar-scroll-hover: #a9b1a8;
  --radius: 3px;
  --radius-lg: 4px;
  --shadow: 0 1px 0 rgba(15, 20, 19, .04);
  --shadow-lg: 0 18px 48px rgba(9, 14, 13, .3), 0 2px 8px rgba(9, 14, 13, .18);
  --sidebar-w: 236px;
  --font: "IBM Plex Sans", "Noto Sans SC", -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, "Cascadia Code", Menlo, Consolas, monospace;
  --topbar-h: 54px;
}

[data-bs-theme="dark"] {
  color-scheme: dark;
  --bg: #0c0f10;
  --panel: #121719;
  --panel-2: #171d1f;
  --line: #242c2e;
  --line-strong: #374245;
  --text: #e4e9e7;
  --muted: #8b9794;
  --primary: #e8a45c;
  --primary-hover: #f2b97c;
  --primary-soft: #2a2118;
  --on-primary: #171008;
  --ok: #5ccb95;
  --warn: #e5c05c;
  --err: #ef7a70;
  --info: #83a9ff;
  --chart-1: #e8a45c;
  --chart-2: #cf8440;
  --chart-3: #a9642c;
  --chart-4: #7f9a86;
  --chart-5: #5b6f68;
  --sidebar: #090c0d;
  --sidebar-fg: #b9c3c0;
  --sidebar-muted: #788480;
  --sidebar-accent: #151b1c;
  --sidebar-active: #1b2224;
  --sidebar-active-fg: #f3e3cf;
  --sidebar-line: #1f2628;
  --sidebar-input: #0b0f10;
  --sidebar-scroll: #2c3537;
  --sidebar-scroll-hover: #404b4d;
  --shadow: 0 1px 0 rgba(0, 0, 0, .4);
  --shadow-lg: 0 18px 52px rgba(0, 0, 0, .62), 0 2px 8px rgba(0, 0, 0, .45);
  /* 兼容旧深色主题里写死的语义底色 */
  --bs-body-bg: var(--panel);
  --bs-body-color: var(--text);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--primary-soft); color: var(--primary); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.relay { display: flex; height: 100vh; overflow: hidden; }

/* ---------- 左轨 ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--sidebar);
  color: var(--sidebar-fg);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--sidebar-line);
  transition: flex-basis .16s ease;
}
.sidebar.collapsed { flex-basis: 60px; }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav a span,
.sidebar.collapsed .nav .nav-item span,
.sidebar.collapsed .side-status span:last-child { display: none; }
.sidebar.collapsed .brand { justify-content: center; padding: 14px 0; }
.sidebar.collapsed .nav a,
.sidebar.collapsed .nav .nav-item { justify-content: center; padding: 10px 0; }
.sidebar.collapsed .nav-filter { padding: 10px 0 2px; justify-content: center; }
.sidebar.collapsed .nav-filter .input { display: none; }
.sidebar.collapsed .nav-group { display: none; }
.sidebar.collapsed .nav { padding: 10px 8px; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--sidebar-line);
}
.brand-mark { width: 30px; height: 30px; flex: 0 0 30px; display: flex; align-items: center; justify-content: center; }
.brand-mark svg { width: 100%; height: 100%; display: block; border-radius: 4px; }
.brand-text strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--sidebar-fg);
}
.brand-text span {
  display: block;
  margin-top: 1px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .08em;
  color: var(--sidebar-muted);
}

.nav-filter { padding: 10px 10px 4px; display: flex; gap: 6px; align-items: center; }
.nav-filter .input {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .02em;
  padding: 6px 8px;
  flex: 1 1 auto;
  min-width: 0;
  background: var(--sidebar-input);
  border-color: var(--sidebar-line);
  color: var(--sidebar-fg);
  border-radius: 2px;
}
.nav-filter .input::placeholder { color: var(--sidebar-muted); }
.nav-filter .input:focus { border-color: var(--primary); background: var(--sidebar-input); box-shadow: 0 0 0 2px rgba(232, 164, 92, .16); }
.nav-custom-btn { width: 28px; height: 28px; flex: 0 0 28px; font-size: 13px; border-radius: 2px; color: var(--sidebar-muted); }
.nav-custom-btn:hover { background: var(--sidebar-accent); color: var(--sidebar-fg); }

.nav-custom-list { display: flex; flex-direction: column; gap: 4px; }
.nav-custom-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel-2);
}
.nav-custom-row .ico { width: 20px; display: flex; justify-content: center; color: var(--muted); }
.nav-custom-row .grow { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.nav-custom-row .grow b { font-size: 12.5px; font-weight: 600; }
.nav-custom-row .grow small { color: var(--muted); font-size: 10.5px; font-family: var(--mono); }
.config-form { display: flex; flex-direction: column; gap: 12px; }
.config-form .config-field { margin: 0; }
.config-form .config-field label { display: block; margin-bottom: 5px; font-size: 12px; font-weight: 600; }
.config-form .config-field .hint { font-weight: 400; }
.log-auto {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: var(--mono);
  white-space: nowrap;
  color: var(--muted);
}
.log-auto input { margin: 0; }

.nav {
  display: block;
  flex: 1;
  padding: 8px 8px 14px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--sidebar-scroll) transparent;
}
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-track { background: transparent; }
.nav::-webkit-scrollbar-thumb {
  background: var(--sidebar-scroll);
  border-radius: 999px;
  border: 1px solid transparent;
  background-clip: content-box;
}
.nav:hover::-webkit-scrollbar-thumb { background: var(--sidebar-scroll-hover); background-clip: content-box; }
.nav-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 8px 6px;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
  color: var(--sidebar-muted);
  text-transform: uppercase;
  letter-spacing: .18em;
}
.nav-group::after { content: ""; flex: 1; height: 1px; background: var(--sidebar-line); }
.nav a, .nav .nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  padding: 7px 10px 7px 11px;
  margin: 1px 0;
  border-radius: 2px;
  color: var(--sidebar-fg);
  background: transparent;
  text-decoration: none;
  font: inherit;
  font-size: 12.5px;
  letter-spacing: .01em;
  text-align: left;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.nav a::before, .nav .nav-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: transparent;
  transition: background .12s;
}
.nav a:hover, .nav .nav-item:hover { background: var(--sidebar-accent); color: var(--text); }
.nav a.active, .nav .nav-item.active { background: var(--sidebar-active); color: var(--sidebar-active-fg); }
.nav a.active::before, .nav .nav-item.active::before { background: var(--primary); }
.nav a .ico, .nav .nav-item .ico {
  width: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--sidebar-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav a.active .ico, .nav .nav-item.active .ico { color: var(--primary); }
.ico svg { display: block; }
.ico img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.ico .ico-emoji { font-size: 16px; line-height: 1; }
.fic { width: 1em; height: 1em; display: block; }

.sidebar-foot { padding: 10px 14px 12px; border-top: 1px solid var(--sidebar-line); font-size: 11px; }
.side-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  color: var(--sidebar-muted);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .03em;
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--sidebar-muted); flex: 0 0 6px; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(92, 203, 149, .12); }
.dot.off { background: var(--err); box-shadow: 0 0 0 3px rgba(239, 122, 112, .12); }

/* ---------- 顶栏 ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--topbar-h);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 14px;
  flex: 0 0 var(--topbar-h);
}
.icon-btn {
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 2px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--muted);
  font-size: 16px;
}
.icon-btn:hover { background: var(--panel-2); border-color: var(--line); color: var(--text); }
.lang-btn { width: auto; min-width: 30px; flex-direction: row; gap: 6px; padding: 0 8px; font-size: 14px; }
.lang-btn [data-lang-label] { font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: .06em; }
#navToggle span { width: 16px; height: 1.5px; background: var(--muted); border-radius: 0; }
#navToggle:hover span { background: var(--text); }
#logoutBtn { font-size: 14px; }
#logoutBtn span { width: auto; height: auto; background: none; border-radius: 0; display: flex; align-items: center; justify-content: center; }
.crumbs {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crumbs::before { content: "// "; color: var(--line-strong); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .05em;
  padding: 4px 8px;
  border-radius: 2px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  white-space: nowrap;
}
.chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.chip-success { border-color: color-mix(in oklab, var(--ok) 34%, var(--line)); background: color-mix(in oklab, var(--ok) 10%, var(--panel)); color: var(--ok); }
.chip-danger { border-color: color-mix(in oklab, var(--err) 34%, var(--line)); background: color-mix(in oklab, var(--err) 10%, var(--panel)); color: var(--err); }
.chip-info { border-color: color-mix(in oklab, var(--info) 34%, var(--line)); background: color-mix(in oklab, var(--info) 10%, var(--panel)); color: var(--info); }
.user { display: flex; align-items: center; gap: 8px; padding-left: 10px; border-left: 1px solid var(--line); }
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 2px;
  background: var(--primary);
  color: var(--on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 12px;
}
.avatar svg, .avatar .bi { font-size: 14px; }
.pool-avatar { width: 28px; height: 28px; font-size: 11px; align-self: flex-start; border-radius: 2px; }
.user-meta span { display: block; font-size: 12px; font-weight: 600; line-height: 1.3; }
.user-meta small { display: block; font-family: var(--mono); font-size: 9.5px; color: var(--muted); letter-spacing: .03em; }

/* ---------- 内容区 ---------- */
.content { flex: 1; overflow-y: auto; padding: 22px 24px 40px; }
.page { max-width: 1380px; margin: 0 auto; animation: fadein .2s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-head {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  margin: 0 0 18px;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.page-head::before {
  content: "";
  width: 2px;
  align-self: stretch;
  min-height: 34px;
  background: var(--primary);
  flex: 0 0 2px;
}
.page-head h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -.01em;
  line-height: 1.2;
}
.page-head p { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; max-width: 92ch; }
.page-head .spacer { margin-left: auto; }
.eyebrow {
  display: block;
  margin-bottom: 3px;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--primary);
}

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-aside { display: grid; gap: 14px; grid-template-columns: minmax(300px, 360px) 1fr; align-items: start; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } .grid-2 { grid-template-columns: 1fr; } .grid-aside { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .grid-4, .grid-3 { grid-template-columns: 1fr; } }

/* ---------- 面板 ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: rl-rise .24s ease both;
}
.panel-head {
  min-height: 40px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
}
.panel-head h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--text);
}
.panel-head h3::before {
  content: "";
  width: 5px;
  height: 5px;
  background: var(--primary);
  flex: 0 0 5px;
}
.panel-head .hint { margin-left: auto; font-size: 11px; color: var(--muted); font-family: var(--mono); }
.panel-body { padding: 14px; }

/* ---------- 指标条 ---------- */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  gap: 1px;
  overflow: hidden;
  margin-bottom: 14px;
}
@media (max-width: 900px) { .stat-strip { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 460px) { .stat-strip { grid-template-columns: 1fr; } }
.stat-cell {
  position: relative;
  background: var(--panel);
  padding: 14px 16px 13px;
  min-width: 0;
}
.stat-cell small {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat-cell small .ico { font-size: 11px; color: var(--muted); opacity: .6; margin-left: auto; }
.stat-cell b {
  display: block;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.stat-cell::after {
  content: "";
  position: absolute;
  left: 16px;
  bottom: 0;
  width: 18px;
  height: 2px;
  background: var(--primary);
  opacity: .5;
}

/* 兼容旧 .stat 类（其他页面可能复用） */
.stat { display: flex; align-items: center; gap: 14px; padding: 16px; }
.stat .ico {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  color: var(--muted);
  background: var(--panel-2);
  flex: 0 0 38px;
}
.stat b { display: block; font-family: var(--mono); font-size: 21px; line-height: 1.15; font-weight: 500; }
.stat small { color: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.g-1, .g-2, .g-3, .g-4, .g-5, .g-ok, .g-err { background: var(--panel-2); color: var(--muted); }

/* ---------- 观测指标块 ---------- */
.tile { display: flex; flex-direction: column; gap: 3px; padding: 14px 16px; }
.tile .t-lab { font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.tile .t-val { font-family: var(--mono); font-size: 22px; font-weight: 500; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile .t-val.t-ok { color: var(--ok); }
.tile .t-val.t-err { color: var(--err); }
.tile .t-sub { font-size: 11px; color: var(--muted); }

/* ---------- 表格 ---------- */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
  background: var(--panel-2);
}
td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: 13px;
}
tbody tr:hover { background: var(--panel-2); }
tbody tr { transition: background .1s; }
tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }
.table-wrap.scroll-x { box-shadow: inset -22px 0 18px -16px rgba(15, 23, 42, .35); }
.rl-logbox { white-space: pre; font-family: var(--mono); font-size: 11.5px; line-height: 1.55; font-variant-ligatures: none; }
.rl-logbox.rl-logbox-wrap { white-space: pre-wrap; word-break: break-all; }
.rl-pre {
  margin: 0;
  background: #0b0e0f;
  color: #d6dee0;
  border: 1px solid #1d2527;
  border-radius: 2px;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  overflow: auto;
}
[data-bs-theme="light"] .rl-pre { background: #121719; color: #d6dee0; }
.rl-codeblock {
  margin: 0;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 420px;
  overflow: auto;
}

.empty { text-align: center; color: var(--muted); padding: 30px 0; font-size: 12.5px; font-family: var(--mono); }
.empty .big { font-size: 30px; margin-bottom: 8px; opacity: .3; }
.rl-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
}
.rl-empty .rl-empty-ico {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel-2);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  margin-bottom: 12px;
}
.rl-empty h4 { margin: 0 0 5px; font-size: 13.5px; font-weight: 600; }
.rl-empty p { margin: 0; color: var(--muted); font-size: 12px; max-width: 420px; line-height: 1.65; }
.rl-empty .rl-empty-act { margin-top: 14px; display: flex; gap: 8px; }
/* 统一加载态：骨架条 + 读屏文案 */
.rl-loading { display: flex; flex-direction: column; gap: 10px; padding: 12px 0; }
.rl-skel { display: flex; flex-direction: column; gap: 8px; }
.rl-skel span {
  height: 9px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--panel-2) 20%, var(--line) 40%, var(--panel-2) 60%);
  background-size: 300% 100%;
  animation: rl-skel 1.4s linear infinite;
}
.rl-skel span:nth-child(1) { width: 38%; }
.rl-skel span:nth-child(2) { width: 72%; }
.rl-skel span:nth-child(3) { width: 54%; }
@keyframes rl-skel { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.table td .rl-loading { padding: 14px 4px; }
.rl-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.rl-cols { display: grid; gap: 16px; }
@media (min-width: 701px) { .rl-cols { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); } .rl-cols > div + div { border-left: 1px solid var(--line); padding-left: 16px; } }
@media (max-width: 700px) { .rl-cols { grid-template-columns: 1fr; } }

.table td.nowrap, .table th.nowrap { white-space: nowrap; }
.table td.clip { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table td.clip.mono { max-width: 150px; }
.clamp1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- 徽标 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .05em;
  padding: 2px 6px;
  border-radius: 2px;
  border: 1px solid var(--line);
  font-weight: 500;
  color: var(--muted);
  line-height: 1.5;
  background: var(--panel-2);
}
.badge::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.badge-ok { color: var(--ok); border-color: color-mix(in oklab, var(--ok) 30%, var(--line)); background: color-mix(in oklab, var(--ok) 8%, var(--panel)); }
.badge-off { color: var(--muted); }
.badge-run { color: var(--info); border-color: color-mix(in oklab, var(--info) 30%, var(--line)); background: color-mix(in oklab, var(--info) 8%, var(--panel)); }
.badge-err { color: var(--err); border-color: color-mix(in oklab, var(--err) 30%, var(--line)); background: color-mix(in oklab, var(--err) 8%, var(--panel)); }
.badge-warn { color: var(--warn); border-color: color-mix(in oklab, var(--warn) 30%, var(--line)); background: color-mix(in oklab, var(--warn) 8%, var(--panel)); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 2px;
  padding: 6px 12px;
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .04em;
  line-height: normal;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-ghost { background: var(--panel); color: var(--text); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { background: var(--panel-2); border-color: var(--line-strong); }
.btn-danger { background: var(--err); color: #fff; border-color: var(--err); }
.btn-danger:hover:not(:disabled) { filter: brightness(.92); }
.btn-outline-danger { background: transparent; color: var(--err); border-color: color-mix(in oklab, var(--err) 45%, var(--line)); }
.btn-outline-danger:hover:not(:disabled) { background: color-mix(in oklab, var(--err) 9%, var(--panel)); border-color: var(--err); }
.btn-sm { padding: 4px 9px; font-size: 10.5px; }
.btn-lg { padding: 9px 18px; font-size: 13px; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 12px; }
.key-create-grid { align-items: end; }
.key-create-grid .field { margin-bottom: 0; }
.key-create-grid .input-row { gap: 8px; }
.field label {
  display: block;
  margin-bottom: 5px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}
.input, .select, textarea.input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: var(--font);
  background: var(--panel);
  color: var(--text);
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 10px) 50%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  padding-right: 28px;
}
.input:hover, .select:hover, textarea.input:hover { border-color: var(--line-strong); }
.input:focus, .select:focus, textarea.input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in oklab, var(--primary) 16%, transparent); }
textarea.input { resize: vertical; min-height: 80px; font-family: var(--mono); font-size: 12px; line-height: 1.6; }
.input-row { display: flex; gap: 6px; }
.input-row .input { flex: 1; }
.input::placeholder { color: color-mix(in oklab, var(--muted) 72%, transparent); }

.card-tabs {
  display: flex;
  gap: 0;
  padding: 0;
  background: transparent;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  width: 100%;
  margin-bottom: 14px;
  overflow-x: auto;
}
.card-tabs button {
  position: relative;
  border: none;
  background: transparent;
  padding: 8px 12px;
  border-radius: 0;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .07em;
  cursor: pointer;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}
.card-tabs button:hover { color: var(--text); background: var(--panel-2); }
.card-tabs button.active { color: var(--primary); background: transparent; box-shadow: none; }
.card-tabs button.active::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -1px;
  height: 2px;
  background: var(--primary);
}

/* ---------- 列表 ---------- */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 2px;
  margin-bottom: 6px;
  background: var(--panel);
  transition: background .12s, border-color .12s;
}
.list-item:hover { background: var(--panel-2); border-color: var(--line-strong); }
.list-item .name { font-weight: 600; font-size: 13px; }
.list-item .desc { font-size: 11.5px; color: var(--muted); }
.list-item .actions { margin-left: auto; display: flex; gap: 5px; flex: 0 0 auto; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .grow .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .dot { flex: 0 0 6px; }
.cmd-row { cursor: pointer; }
.cmd-row .cmd-ico {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 13px;
}
.cmd-row:hover .cmd-ico { color: var(--primary); border-color: color-mix(in oklab, var(--primary) 40%, var(--line)); }
.cmd-row .cmd-no { font-family: var(--mono); font-size: 9.5px; color: var(--muted); opacity: .7; letter-spacing: .08em; }
.cmd-row .actions { font-family: var(--mono); font-size: 12px; color: var(--muted); opacity: .55; margin-left: auto; }
.cmd-row:hover .actions { color: var(--primary); }
@media (max-width: 700px) {
  #featureList .list-item, #scriptList .list-item, #marketList .list-item { flex-wrap: wrap; }
  #featureList .list-item .actions, #scriptList .list-item .actions, #marketList .list-item .actions { width: 100%; margin-left: 0; justify-content: flex-end; flex-wrap: wrap; }
  #scriptList .list-item .grow .name, #featureList .list-item .grow .name, #marketList .list-item .grow .name { white-space: normal; overflow: visible; text-overflow: clip; word-break: break-word; }
}

/* ---------- 消息 ---------- */
.msg-bubble {
  max-width: 76%;
  padding: 8px 12px;
  border-radius: 2px;
  font-size: 13px;
  line-height: 1.6;
  word-break: break-word;
}
.msg-in { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); border-left: 2px solid var(--line-strong); }
.msg-out { align-self: flex-end; background: var(--primary-soft); border: 1px solid color-mix(in oklab, var(--primary) 30%, var(--line)); border-right: 2px solid var(--primary); color: var(--text); }
.msg-meta { font-family: var(--mono); font-size: 9.5px; letter-spacing: .04em; color: var(--muted); margin-bottom: 3px; }
.chat-stream {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: calc(100vh - 296px);
  min-height: 320px;
  overflow-y: auto;
  padding: 4px 6px 4px 2px;
}
.conv-item {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 9px;
  padding: 7px 9px;
  border-radius: 2px;
  cursor: pointer;
  border: 1px solid transparent;
  border-left: 2px solid transparent;
  margin-bottom: 2px;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  transition: background .12s, border-color .12s;
}
.conv-item:hover { background: var(--panel-2); }
.conv-item.active { background: var(--panel-2); border-color: var(--line); border-left-color: var(--primary); }
.conv-item .conv-ico {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel);
  color: var(--muted);
  font-size: 11px;
}
.conv-item.active .conv-ico { color: var(--primary); border-color: color-mix(in oklab, var(--primary) 40%, var(--line)); }
.conv-item .cname { font-weight: 500; font-size: 12.5px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item .conv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.conv-item .conv-app-line { display: inline-flex; align-items: center; gap: 4px; min-width: 0; color: var(--muted); font-size: 10.5px; line-height: 14px; }
.conv-item .conv-app-line .conv-app-av { width: 14px; height: 14px; font-size: 8px; border-radius: 50%; flex: 0 0 auto; }
.conv-item .conv-app-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item .conv-app-none { font-family: var(--mono); letter-spacing: .02em; }
.chat-grid { display: grid; gap: 14px; grid-template-columns: 290px 1fr; align-items: start; }
@media (max-width: 860px) { .chat-grid { grid-template-columns: 1fr; } }

/* ---------- 提示条 ---------- */
.rl-toasts { top: calc(var(--topbar-h) + 14px); right: 20px; left: auto; bottom: auto; z-index: 1095; }
.rl-toast {
  min-width: 260px;
  max-width: 380px;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--info);
  border-radius: 2px;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.rl-toast .toast-body { display: flex; align-items: center; gap: 9px; padding: 10px 4px 10px 12px; font-size: 12px; line-height: 1.45; }
.rl-toast-ico { font-size: 13px; flex: 0 0 auto; color: var(--info); }
.rl-toast-msg { flex: 1 1 auto; }
.rl-toast-x { margin: 0 10px 0 4px; flex: 0 0 auto; opacity: .6; }
.rl-toast-x:hover { opacity: 1; }
.rl-toast-act { flex: 0 0 auto; white-space: nowrap; border-color: var(--line-strong); color: inherit; }
.rl-toast-act:hover { background: var(--panel-2); color: inherit; }
.rl-toast.rl-toast-ok { border-left-color: var(--ok); }
.rl-toast.rl-toast-ok .rl-toast-ico { color: var(--ok); }
.rl-toast.rl-toast-err { border-left-color: var(--err); }
.rl-toast.rl-toast-err .rl-toast-ico { color: var(--err); }

/* ---------- 弹窗 ---------- */
.modal-dialog { max-width: 560px; }
.modal-body { max-height: 60vh; overflow-y: auto; }
.modal-title { font-weight: 600; font-size: 13px; letter-spacing: .04em; }
.modal-body textarea.input { resize: vertical; font-family: var(--mono); font-size: 12px; line-height: 1.6; }
.modal-body .code-editor {
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre;
  overflow: auto;
  tab-size: 2;
  -moz-tab-size: 2;
  line-height: 1.55;
}
.modal-body .rl-confirm-msg { margin: 0; line-height: 1.65; overflow-wrap: anywhere; word-break: break-word; }
.modal-body .script-out {
  margin: 0;
  max-height: 280px;
  overflow: auto;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.modal-body .grid.grid-2 { gap: 12px; }

/* ---------- 通用 ---------- */
code {
  background: var(--panel-2);
  border: 1px solid var(--line);
  padding: 1px 5px;
  border-radius: 2px;
  font-size: 11px;
  font-family: var(--mono);
}
.mono { font-family: var(--mono); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.strong { font-weight: 600; }
.rl-row { display: flex; gap: 10px; align-items: center; }
.rl-row .grow { flex: 1; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.text-right { text-align: right; }
.hint { font-size: 11.5px; color: var(--muted); }

.kv { display: flex; align-items: baseline; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: none; }
.kv .k {
  width: 108px;
  flex: 0 0 108px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.kv .v { flex: 1; word-break: break-all; font-size: 12.5px; }
.kv .v code { font-size: 11px; }

.conn-card { display: flex; flex-direction: column; gap: 12px; }
.conn-state {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px 9px 12px;
  border-radius: 2px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.conn-state::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--line-strong);
}
.conn-state.on::before { background: var(--ok); }
.conn-state.off::before { background: var(--err); }
.conn-state.on { background: color-mix(in oklab, var(--ok) 5%, var(--panel)); border-color: color-mix(in oklab, var(--ok) 22%, var(--line)); }
.conn-state.off { background: color-mix(in oklab, var(--err) 5%, var(--panel)); border-color: color-mix(in oklab, var(--err) 22%, var(--line)); }
.health-card { border: 1px solid var(--line); border-radius: 3px; padding: 10px 12px; background: var(--panel-2); }
.health-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; font-size: 12.5px; }
.health-card .input-row { gap: 6px; flex-wrap: wrap; }
.conn-state .dot { width: 6px; height: 6px; flex: 0 0 6px; }
.conn-state .grow { flex: 1; min-width: 0; }
.conn-state .grow b { font-size: 12.5px; font-weight: 600; display: block; }
.conn-state .grow .muted { word-break: break-word; font-size: 11px !important; }
.conn-main { flex: 1; min-width: 0; }
.conn-av-stack { display: inline-flex; align-items: center; padding-left: 7px; margin-right: 2px; }
.conn-av-stack .conn-av { display: inline-flex; margin-left: -7px; border-radius: 50%; box-shadow: 0 0 0 2px var(--panel); }
.conn-av-stack .conn-av:first-child { margin-left: 0; }
.conn-av-stack .conn-avatar { border-radius: 50%; }
.conn-av-more { margin-left: 4px; font-family: var(--mono); font-size: 10px; color: var(--muted); }
.conn-app-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.conn-app-list .app-chip { flex: 0 0 auto; max-width: 100%; white-space: nowrap; }
.conn-acct-list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.conn-acct-row { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border: 1px solid var(--line); border-radius: 2px; background: color-mix(in oklab, var(--panel) 82%, var(--bg)); }
.conn-acct-row.active { border-color: color-mix(in oklab, var(--primary) 36%, var(--line)); background: color-mix(in oklab, var(--primary) 6%, var(--panel)); }
.conn-acct-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.conn-acct-main b, .conn-acct-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn-acct-main b { font-size: 12px; font-weight: 600; }
.conn-acct-main small { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.conn-acct-row .badge { flex: 0 0 auto; }
@media (max-width: 560px) {
  .conn-acct-row { flex-wrap: wrap; }
  .conn-acct-main { flex-basis: calc(100% - 40px); }
}

/* ---------- 登录页 ---------- */
.login-page { min-height: 100vh; display: flex; background: var(--bg); }
.login-left {
  flex: 1.15;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 56px;
  position: relative;
  overflow: hidden;
  background: #0d1112;
  color: #e8eeec;
}
.login-left::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%);
}
.login-left::after {
  content: "";
  position: absolute;
  width: 2px;
  height: 220px;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  background: linear-gradient(to bottom, transparent, var(--primary), transparent);
}
.login-left .inner { position: relative; z-index: 1; max-width: 440px; }
.login-left h1 { font-size: 30px; margin: 0 0 12px; letter-spacing: -.015em; font-weight: 600; line-height: 1.2; }
.login-left p { color: #94a19d; font-size: 13.5px; line-height: 1.75; margin: 0 0 26px; }
.login-left .brand-row { display: flex; align-items: center; gap: 12px; margin-bottom: 34px; }
.login-left .brand-row strong { font-size: 13px; letter-spacing: .18em; text-transform: uppercase; color: #eef3f1; }
.login-features { display: flex; gap: 8px; flex-wrap: wrap; }
.login-features span {
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(255, 255, 255, .1);
  padding: 5px 10px;
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .06em;
  color: #9aa7a3;
}
.login-right { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px; }
.login-card { width: min(380px, 100%); }
.login-card .brand-row { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.login-card h2 { margin: 0 0 5px; font-size: 20px; letter-spacing: -.01em; font-weight: 600; }
.login-card .sub { color: var(--muted); font-size: 12.5px; margin: 0 0 22px; }
.login-card .brand-row strong { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
@media (max-width: 860px) { .login-left { display: none; } }

/* ---------- 功能 / Agent 工作台 ---------- */
.rl-dim { opacity: .5; }
.rl-switch { margin: 0; min-height: 18px; padding-left: 0; }
.rl-switch .form-check-input { float: none; width: 32px; height: 17px; margin: 0; cursor: pointer; box-shadow: none; border-radius: 2px; }
.rl-switch .form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.rl-switch .form-check-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in oklab, var(--primary) 18%, transparent); }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.check input { margin: 0; }
.rl-out {
  margin: 12px 0 0;
  background: var(--panel-2);
  border: 1px solid var(--line);
  padding: 12px 14px;
  border-radius: 2px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow: auto;
  line-height: 1.6;
  font-family: var(--mono);
  font-size: 11.5px;
}

@keyframes rl-flash { 0% { opacity: .25; } 100% { opacity: 1; } }
.tile .t-val.rl-flash { animation: rl-flash .5s ease; }
@keyframes rl-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .page, .panel, .tile .t-val.rl-flash { animation: none !important; transition: none !important; }
  .rl-skel span { animation: none !important; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) { .content { padding: 18px; } }
@media (max-width: 700px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .crumbs { display: none; }
  #chipAcct { display: none; }
  .user-meta { display: none; }
  .content { padding: 14px 12px 32px; padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }
  .page-head { gap: 10px; }
  .page-head h2 { font-size: 17px; }
  .stat-cell { padding: 12px 13px; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .table-wrap::-webkit-scrollbar { height: 5px; }
  .table-wrap::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 0; }
}

/* 移动端：侧边栏抽屉 */
.sidebar-backdrop { display: none; }
.sidebar-close { display: none; }
@media (max-width: 860px) {
  .relay { height: 100dvh; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    z-index: 1045;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .sidebar .brand { padding-right: 48px; }
  .sidebar-close {
    display: flex;
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1;
    background: var(--sidebar);
  }
  body.nav-open { overflow: hidden; }
  .sidebar.collapsed { flex-basis: var(--sidebar-w); }
  .sidebar.collapsed .brand-text,
  .sidebar.collapsed .nav a span,
  .sidebar.collapsed .nav .nav-item span,
  .sidebar.collapsed .side-status span:last-child { display: inline; }
  .sidebar.collapsed .brand { justify-content: flex-start; padding: 16px; }
  .sidebar.collapsed .nav a, .sidebar.collapsed .nav .nav-item { justify-content: flex-start; padding: 7px 10px 7px 11px; }
  .sidebar.collapsed .nav-group { display: flex; }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(6, 9, 10, .55);
    z-index: 1040;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
  }
  .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
  .content { padding: 16px 14px 32px; }
}

/* ==========================================================================
   Bootstrap 5.3 主题桥接
   ========================================================================== */
:root {
  --bs-font-sans-serif: var(--font);
  --bs-body-font-family: var(--font);
  --bs-body-bg: var(--panel);
  --bs-body-color: var(--text);
  --bs-emphasis-color: var(--text);
  --bs-secondary-color: var(--muted);
  --bs-secondary-bg: var(--panel-2);
  --bs-tertiary-bg: var(--panel-2);
  --bs-border-color: var(--line);
  --bs-border-radius: var(--radius);
  --bs-border-radius-sm: 2px;
  --bs-border-radius-lg: 4px;
  --bs-link-color: var(--primary);
  --bs-link-hover-color: var(--primary-hover);
  --bs-link-decoration: none;
  --bs-code-color: var(--text);
  --bs-focus-ring-color: color-mix(in oklab, var(--primary) 24%, transparent);
  --bs-focus-ring-width: 2px;
}
h1, h2, h3, h4, h5, h6 { font-weight: 600; letter-spacing: -.005em; }

.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--line);
  --bs-table-hover-bg: var(--panel-2);
  --bs-table-hover-color: var(--text);
  --bs-table-striped-bg: var(--panel-2);
  --bs-table-striped-color: var(--text);
  margin-bottom: 0;
}
.table > :not(caption) > * > * { padding: 9px 12px; border-bottom-width: 1px; }
.table thead th { font-size: 9.5px; font-weight: 500; }
.card {
  --bs-card-bg: var(--panel);
  --bs-card-border-color: var(--line);
  --bs-card-border-radius: var(--radius);
  --bs-card-inner-border-radius: 2px;
  --bs-card-color: var(--text);
  --bs-card-cap-bg: transparent;
  --bs-card-cap-color: var(--text);
  --bs-card-title-color: var(--text);
  --bs-card-subtitle-color: var(--muted);
  --bs-card-spacer-x: 16px;
  --bs-card-spacer-y: 16px;
  --bs-card-box-shadow: none;
}
.dropdown-menu {
  --bs-dropdown-bg: var(--panel);
  --bs-dropdown-color: var(--text);
  --bs-dropdown-border-color: var(--line-strong);
  --bs-dropdown-border-radius: var(--radius);
  --bs-dropdown-inner-border-radius: 2px;
  --bs-dropdown-divider-bg: var(--line);
  --bs-dropdown-link-color: var(--text);
  --bs-dropdown-link-hover-bg: var(--panel-2);
  --bs-dropdown-link-hover-color: var(--primary);
  --bs-dropdown-link-active-bg: var(--primary);
  --bs-dropdown-link-active-color: var(--on-primary);
  --bs-dropdown-link-disabled-color: var(--muted);
  --bs-dropdown-header-color: var(--muted);
  --bs-dropdown-box-shadow: var(--shadow-lg);
  --bs-dropdown-font-size: 12.5px;
}
.form-control, .form-select, .form-check-input {
  --bs-border-color: var(--line);
  font-size: 13px;
  color: var(--text);
  border-radius: 2px;
  background-color: var(--panel);
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  background-color: var(--panel);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--primary) 16%, transparent);
}
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-label { font-size: 10px; font-family: var(--mono); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.progress {
  --bs-progress-bg: var(--panel-2);
  --bs-progress-height: 6px;
  --bs-progress-border-radius: 0;
  --bs-progress-bar-bg: var(--primary);
  --bs-progress-bar-color: var(--on-primary);
  --bs-progress-font-size: 10px;
}
.tooltip {
  --bs-tooltip-bg: #101416;
  --bs-tooltip-color: #e4e9e7;
  --bs-tooltip-border-radius: 2px;
  --bs-tooltip-padding-x: 8px;
  --bs-tooltip-padding-y: 5px;
  --bs-tooltip-font-size: 10.5px;
}
.popover {
  --bs-popover-bg: var(--panel);
  --bs-popover-border-color: var(--line-strong);
  --bs-popover-border-radius: var(--radius);
  --bs-popover-inner-border-radius: 2px;
  --bs-popover-header-bg: var(--panel-2);
  --bs-popover-header-color: var(--text);
  --bs-popover-body-color: var(--text);
  --bs-popover-box-shadow: var(--shadow-lg);
  --bs-popover-max-width: 320px;
}
.offcanvas {
  --bs-offcanvas-bg: var(--panel);
  --bs-offcanvas-color: var(--text);
  --bs-offcanvas-border-color: var(--line);
  --bs-offcanvas-box-shadow: var(--shadow-lg);
}
.modal {
  --bs-modal-bg: var(--panel);
  --bs-modal-color: var(--text);
  --bs-modal-border-color: var(--line-strong);
  --bs-modal-border-radius: var(--radius);
  --bs-modal-box-shadow: var(--shadow-lg);
  --bs-modal-padding: 16px 18px;
  --bs-modal-header-padding: 13px 18px;
  --bs-modal-header-border-color: var(--line);
  --bs-modal-footer-border-color: var(--line);
  --bs-modal-footer-gap: 8px;
}
.toast {
  --bs-toast-bg: var(--panel);
  --bs-toast-color: var(--text);
  --bs-toast-border-width: 1px;
  --bs-toast-border-color: var(--line-strong);
  --bs-toast-border-radius: 2px;
  --bs-toast-font-size: 12px;
  --bs-toast-padding-x: 4px;
  --bs-toast-padding-y: 0;
  --bs-toast-box-shadow: var(--shadow-lg);
}
.list-group {
  --bs-list-group-bg: var(--panel);
  --bs-list-group-color: var(--text);
  --bs-list-group-border-color: var(--line);
  --bs-list-group-border-radius: var(--radius);
  --bs-list-group-item-padding-x: 12px;
  --bs-list-group-item-padding-y: 9px;
  --bs-list-group-action-hover-bg: var(--panel-2);
  --bs-list-group-action-hover-color: var(--text);
  --bs-list-group-action-active-bg: var(--panel-2);
  --bs-list-group-active-bg: var(--primary);
  --bs-list-group-active-border-color: var(--primary);
  --bs-list-group-active-color: var(--on-primary);
}
.pagination {
  --bs-pagination-bg: var(--panel);
  --bs-pagination-color: var(--text);
  --bs-pagination-border-color: var(--line);
  --bs-pagination-hover-bg: var(--panel-2);
  --bs-pagination-hover-color: var(--primary);
  --bs-pagination-hover-border-color: var(--line-strong);
  --bs-pagination-active-bg: var(--primary);
  --bs-pagination-active-border-color: var(--primary);
  --bs-pagination-active-color: var(--on-primary);
  --bs-pagination-disabled-bg: var(--panel);
  --bs-pagination-disabled-color: var(--muted);
  --bs-pagination-border-radius: 2px;
  --bs-pagination-font-size: 11.5px;
}
.accordion {
  --bs-accordion-bg: var(--panel);
  --bs-accordion-color: var(--text);
  --bs-accordion-border-color: var(--line);
  --bs-accordion-border-radius: var(--radius);
  --bs-accordion-inner-border-radius: 2px;
  --bs-accordion-btn-color: var(--text);
  --bs-accordion-btn-bg: var(--panel);
  --bs-accordion-active-color: var(--primary);
  --bs-accordion-active-bg: var(--primary-soft);
  --bs-accordion-btn-focus-box-shadow: 0 0 0 2px color-mix(in oklab, var(--primary) 18%, transparent);
}
.alert { --bs-alert-border-radius: var(--radius); --bs-alert-padding-x: 14px; --bs-alert-padding-y: 10px; --bs-alert-margin-bottom: 14px; }
.spinner-border, .spinner-grow { color: var(--primary); }

/* 观测页：6 格指标条 */
.stat-strip.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .stat-strip.cols-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 460px) { .stat-strip.cols-3 { grid-template-columns: 1fr; } }
.stat-cell.tile { padding: 14px 16px; gap: 3px; }
.stat-cell.tile::after { display: none; }
.stat-cell.tile .t-lab { color: var(--muted); }
.stat-cell.tile .t-val { margin-top: 4px; color: var(--text); }

/* 列表项图标块 */
.li-ico {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 13px;
}

/* ---------- 细节收敛 ---------- */
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: none; }

.grid { align-items: start; }

/* 面板内列表：用发丝线代替独立卡片，形成表格化阅读节奏 */
.panel-body > .list > .list-item,
.panel-body > .list-item {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  margin: 0;
  padding: 9px 2px;
  background: transparent;
}
.panel-body > .list > .list-item:last-child,
.panel-body > .list-item:last-child { border-bottom: 0; }
.panel-body > .list > .list-item:hover,
.panel-body > .list-item:hover { background: var(--panel-2); }

.empty { padding: 24px 0; }
.rl-empty { padding: 30px 20px; }

/* 登录卡：把表单收进边框内，避免右侧大面积漂浮 */
.login-card {
  width: min(390px, 100%);
  position: relative;
  padding: 26px 26px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.login-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  width: 54px;
  height: 2px;
  background: var(--primary);
}
.login-card::after {
  content: "LOCAL CONSOLE · AUTH REQUIRED";
  display: block;
  margin-top: 16px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: .18em;
  color: var(--muted);
}
.login-card .brand-row { margin-bottom: 20px; }
.login-right { border-left: 1px solid var(--line); }
@media (max-width: 860px) { .login-right { border-left: 0; } }

/* 消息页：两栏等高，会话栏内部滚动 */
.chat-grid > .panel { height: calc(100vh - 218px); min-height: 420px; display: flex; flex-direction: column; }
.chat-grid > .panel > .panel-body { overflow-y: auto; }
.chat-grid > .panel:last-child > .panel-body { overflow: hidden; flex: 1; }
.chat-grid .chat-stream { flex: 1; height: auto; min-height: 0; }

/* ---------- 运行日志查看器 ---------- */
.log-panel { overflow: hidden; }
.log-toolbar {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 14px;
  padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--panel-2); flex-wrap: wrap;
}
.log-filters { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; min-width: 0; flex: 1 1 560px; }
.log-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.log-field > span {
  font-family: var(--mono); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.log-field .input, .log-field .select { height: 28px; font-size: 12px; padding-top: 2px; padding-bottom: 2px; }
.log-field .input[type="date"] { width: 134px; }
.log-field #logTail { width: 86px; }
.log-search { flex: 1 1 190px; }
.log-search .input { width: 100%; min-width: 150px; }
.log-check {
  display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 2px;
  font-size: 12px; color: var(--muted); white-space: nowrap; cursor: pointer;
}
.log-check input { margin: 0; }
.log-stats { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.log-chip {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 2px; background: transparent; color: var(--muted);
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .02em; cursor: pointer; white-space: nowrap;
  transition: border-color .12s ease, color .12s ease, background .12s ease;
}
.log-chip b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.log-chip:hover { border-color: var(--line-strong); color: var(--text); }
.log-chip.active { border-color: color-mix(in oklab, var(--primary) 55%, var(--line)); background: color-mix(in oklab, var(--primary) 10%, transparent); color: var(--text); }
.log-chip[data-level="error"] b { color: var(--err); }
.log-chip[data-level="warn"] b { color: var(--warn); }
.log-chip[data-level="info"] b { color: var(--info); }
.log-vp { position: relative; }
.log-viewport {
  height: clamp(340px, calc(100vh - 330px), 780px);
  overflow: auto; background: #0a0d0e; color: #c9d2cf;
  font-family: var(--mono); font-size: 12px; line-height: 1.62;
  font-variant-ligatures: none; tab-size: 2;
}
[data-bs-theme="light"] .log-viewport { background: #101516; color: #d4dcd9; }
.log-row {
  display: flex; align-items: baseline; gap: 10px; width: max-content; min-width: 100%;
  padding: 1px 14px 1px 0; border-left: 2px solid transparent;
}
.log-row:hover { background: rgba(255, 255, 255, .035); }
.log-row.lv-error, .log-row.lv-fatal { border-left-color: var(--err); background: rgba(220, 92, 80, .07); }
.log-row.lv-warn, .log-row.lv-warning { border-left-color: var(--warn); background: rgba(214, 158, 46, .055); }
.log-no {
  flex: 0 0 42px; width: 42px; padding-right: 6px; text-align: right;
  color: #45504d; user-select: none; position: sticky; left: 0; background: #0a0d0e;
}
[data-bs-theme="light"] .log-no { background: #101516; }
.log-row.lv-error .log-no, .log-row.lv-fatal .log-no { background: #140d0c; }
.log-row.lv-warn .log-no, .log-row.lv-warning .log-no { background: #13110c; }
.log-time { flex: 0 0 auto; color: #7c8985; }
.log-level { flex: 0 0 46px; width: 46px; font-weight: 600; font-size: 10.5px; letter-spacing: .04em; }
.log-src {
  flex: 0 0 124px; width: 124px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: #64716d; text-decoration: underline dotted rgba(100, 113, 109, .35); text-underline-offset: 2px;
}
.log-msg { flex: 1 0 auto; min-width: 0; white-space: pre; }
.log-row.lv-debug .log-level { color: #5c6a66; }
.log-row.lv-info .log-level { color: #5fa8c8; }
.log-row.lv-warn .log-level, .log-row.lv-warning .log-level { color: var(--warn); }
.log-row.lv-error .log-level { color: var(--err); }
.log-row.lv-fatal .log-level { color: #f07178; }
.log-method { color: #d7b46a; font-weight: 600; }
.log-path { color: #a8c4c7; }
.log-dur { color: #788682; }
.log-status { font-weight: 600; }
.log-status.s-ok { color: #67b98c; }
.log-status.s-info { color: #6fb3d2; }
.log-status.s-warn { color: var(--warn); }
.log-status.s-err { color: var(--err); }
.log-trace {
  padding: 0; border: 0; background: transparent; color: #6f949c; font: inherit; cursor: pointer;
  text-decoration: underline dotted rgba(111, 148, 156, .45); text-underline-offset: 2px;
}
.log-trace:hover { color: #9cc4cc; }
.log-viewport mark { background: rgba(230, 168, 60, .3); color: #fff3d6; padding: 0 1px; border-radius: 1px; }
.log-viewport.rl-logbox-wrap .log-row { width: auto; min-width: 100%; align-items: flex-start; }
.log-viewport.rl-logbox-wrap .log-msg { white-space: pre-wrap; word-break: break-word; flex: 1 1 auto; }
.log-latest {
  position: absolute; right: 18px; bottom: 14px; z-index: 2;
  height: 28px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 2px;
  background: color-mix(in oklab, var(--panel) 88%, transparent); color: var(--text);
  font-family: var(--mono); font-size: 11px; cursor: pointer; box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
  backdrop-filter: blur(4px);
}
.log-latest:hover { border-color: var(--primary); }
.log-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; height: 100%; min-height: 260px; color: #7c8985; text-align: center; }
.log-empty b { color: #c9d2cf; font-family: var(--font, inherit); font-size: 13px; font-weight: 600; }
.log-empty p { margin: 0; font-size: 11.5px; }
.log-empty .btn { margin-top: 6px; }
.log-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 12px; border-top: 1px solid var(--line); background: var(--panel-2);
  color: var(--muted); font-size: 11px; font-family: var(--mono);
}
.log-foot .hint { font-family: inherit; }
@media (max-width: 900px) {
  .log-toolbar { padding: 9px 10px; }
  .log-filters { flex: 1 1 100%; }
  .log-stats { flex: 1 1 100%; }
  .log-src { display: none; }
  .log-level { flex-basis: 42px; width: 42px; }
  .log-no { flex-basis: 32px; width: 32px; }
  .log-viewport { height: calc(100vh - 350px); min-height: 300px; font-size: 11.5px; }
  .log-foot .hint { display: none; }
}
@media (max-width: 520px) {
  .log-search { flex-basis: 100%; }
  .log-field .input[type="date"] { width: 126px; }
  .log-row { gap: 7px; }
  .log-time { font-size: 10.5px; }
}

/* ---------- 头像同步（账号 / 应用 / 会话） ---------- */
.avatar { position: relative; overflow: hidden; flex: 0 0 auto; }
.avatar .av-fb { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.top-avatar { border: 1px solid color-mix(in oklab, var(--primary) 45%, var(--line)); }
.conn-avatar { width: 22px; height: 22px; font-size: 10px; }
.conn-account-head { display: flex; align-items: center; gap: 6px; }
.conv-avatar { width: 24px; height: 24px; font-size: 10px; border-radius: 2px; }
.msg-item { display: flex; gap: 8px; width: 100%; align-items: flex-start; }
.msg-item-out { flex-direction: row-reverse; }
.msg-avatar { width: 26px; height: 26px; font-size: 10px; margin-top: 14px; }
.msg-main { display: flex; flex-direction: column; max-width: calc(100% - 42px); min-width: 0; }
.msg-item-in .msg-main { align-items: flex-start; }
.msg-item-out .msg-main { align-items: flex-end; }
.msg-main .msg-meta { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-main .msg-bubble { max-width: 100%; white-space: pre-wrap; }
.conv-avatar { border: 1px solid color-mix(in oklab, var(--line) 80%, transparent); }
.chat-stream { padding: 8px 8px 8px 4px; }
#chipWs, #chipAcct { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
@media (max-width: 720px) {
  #chipWs, #chipAcct { max-width: 96px; }
  .msg-avatar { width: 22px; height: 22px; }
  .msg-main { max-width: calc(100% - 34px); }
}

/* ---------- AI 接入 ---------- */
.ai-step .panel-body { padding: 16px 18px; }
.ai-step .eyebrow { color: var(--primary); font-size: 10px; letter-spacing: .16em; }
.ai-step h3 { margin: 4px 0 6px; font-size: 14px; }
.ai-step p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.key-warn { color: var(--warn); }
#keyCreateRow { flex-wrap: wrap; }
#keyCreateRow .input { flex: 1 1 240px; }
.ai-prompt {
  margin: 0;
  padding: 14px 16px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.75;
  max-height: 380px;
  overflow: auto;
}
.key-token {
  padding: 12px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--panel-2);
  word-break: break-all;
  font-size: 12.5px;
  user-select: all;
}

/* ---------- 插件目录树与多应用标签 ---------- */
.avatar .av-fb { background: hsl(var(--av-h, 215) 38% 32%); }
.plugin-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.plugin-tree-map { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; min-width: 0; }
.ptm-node { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 3px; background: color-mix(in oklab, var(--panel) 85%, var(--bg)); white-space: nowrap; }
.ptm-node b { color: var(--fg); font-family: var(--mono); font-size: 12px; }
.ptm-node .ico { display: inline-flex; font-size: 12px; }
.ptm-link { width: 20px; height: 1px; background: var(--line); position: relative; }
.ptm-link::after { content: ""; position: absolute; right: -1px; top: -2px; width: 4px; height: 4px; border-radius: 50%; background: var(--line-strong, var(--line)); }
.plugin-search { width: 230px; max-width: 100%; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 5px 11px; font-size: 12px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.active { background: color-mix(in oklab, var(--primary) 14%, var(--panel)); color: var(--fg); }
.plugin-folder { border-bottom: 1px solid color-mix(in oklab, var(--line) 60%, transparent); }
.plugin-folder:last-child { border-bottom: 0; }
.plugin-folder-head { width: 100%; display: flex; align-items: center; gap: 8px; padding: 10px 16px; border: 0; background: color-mix(in oklab, var(--panel) 88%, var(--bg)); color: var(--fg); cursor: pointer; text-align: left; }
.plugin-folder-head:hover { background: color-mix(in oklab, var(--primary) 7%, var(--panel)); }
.plugin-folder-head b { font-size: 13px; }
.pf-chevron { display: inline-flex; font-size: 10px; color: var(--muted); transition: transform .16s ease; }
.plugin-folder.folded .pf-chevron { transform: rotate(-90deg); }
.pf-ico { display: inline-flex; color: var(--primary); }
.pf-count { font-family: var(--mono); font-size: 11px; color: var(--muted); padding: 0 6px; border: 1px solid var(--line); border-radius: 99px; }
.pf-line { flex: 1; height: 1px; margin-left: 4px; background: linear-gradient(90deg, var(--line), transparent); }
.plugin-folder-body { padding: 2px 14px 10px 26px; position: relative; }
.plugin-folder-body::before { content: ""; position: absolute; left: 17px; top: 0; bottom: 10px; border-left: 1px dashed color-mix(in oklab, var(--line) 80%, transparent); }
.plugin-folder.folded .plugin-folder-body { display: none; }
.pf-svc-count { font-family: var(--mono); font-size: 10px; color: var(--muted); border: 1px dashed var(--line); border-radius: 99px; padding: 0 6px; }
.plugin-folder-sub { border: 1px solid color-mix(in oklab, var(--line) 70%, transparent); border-radius: 3px; margin: 6px 0; overflow: hidden; background: color-mix(in oklab, var(--panel) 92%, var(--bg)); }
.plugin-folder-sub .plugin-folder-head { padding: 7px 10px; background: color-mix(in oklab, var(--panel-2) 70%, var(--panel)); }
.plugin-folder-sub .plugin-folder-head b { font-size: 12px; }
.plugin-folder-sub .plugin-folder-body { padding: 2px 8px 8px 18px; }
.plugin-folder-sub .plugin-folder-body::before { left: 10px; }
.plugin-service-tag { border-style: dashed; color: color-mix(in oklab, var(--primary) 62%, var(--muted)); }
.plugin-row { border: 1px solid transparent; border-radius: 3px; }
.plugin-row:hover { border-color: var(--line); background: color-mix(in oklab, var(--primary) 4%, transparent); }
.plugin-flat { display: flex; align-items: flex-start; gap: 10px; }
.plugin-flat .plugin-row { flex: 1; min-width: 0; }
.plugin-class-tag { flex: 0 0 auto; margin-top: 13px; font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 2px; padding: 2px 6px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.app-chip { display: inline-flex; align-items: center; gap: 5px; max-width: 190px; padding: 2px 7px 2px 2px; border: 1px solid var(--line); border-radius: 99px; background: color-mix(in oklab, var(--panel) 80%, var(--bg)); color: var(--muted); font-size: 11px; line-height: 16px; }
.app-chip-all { padding: 2px 8px; }
.app-chip-all .ico { display: inline-flex; font-size: 11px; }
.app-chip-av { width: 16px; height: 16px; flex: 0 0 auto; border-radius: 50%; overflow: hidden; position: relative; display: inline-flex; align-items: center; justify-content: center; }
.app-chip-av .avatar img { border-radius: 50%; }
.app-chip-av-fb { background: color-mix(in oklab, var(--primary) 25%, var(--panel)); color: var(--fg); font-family: var(--mono); font-size: 9px; }
@media (max-width: 760px) {
  .plugin-tree-map { width: 100%; font-size: 11px; overflow-x: auto; padding-bottom: 2px; }
  .plugin-search { flex: 1; width: auto; min-width: 150px; }
  .plugin-toolbar { gap: 8px; }
  .plugin-folder-body { padding-left: 18px; }
  .plugin-folder-body::before { left: 10px; }
  .plugin-flat { flex-direction: column; gap: 2px; }
  .plugin-class-tag { margin: 6px 0 0 12px; }
}

/* ---------- 吉祥物挂件 ---------- */
.dudu { position: fixed; right: 20px; bottom: 18px; z-index: 1080; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.dudu-card { pointer-events: auto; width: 112px; border: 1px solid var(--line); border-radius: 6px; background: linear-gradient(180deg, color-mix(in oklab, var(--panel) 94%, var(--bg)), color-mix(in oklab, var(--bg) 88%, var(--panel))); box-shadow: 0 12px 30px rgba(0,0,0,.28), inset 0 1px 0 color-mix(in oklab, #fff 8%, transparent); overflow: hidden; }
.dudu-stage { display: block; width: 100%; height: 118px; padding: 4px 4px 0; border: 0; background: radial-gradient(circle at 50% 78%, color-mix(in oklab, var(--primary) 16%, transparent), transparent 62%), repeating-linear-gradient(0deg, transparent 0 11px, color-mix(in oklab, var(--line) 28%, transparent) 11px 12px), repeating-linear-gradient(90deg, transparent 0 11px, color-mix(in oklab, var(--line) 18%, transparent) 11px 12px); cursor: pointer; }
.dudu-stage img { width: 100%; height: 100%; object-fit: contain; display: block; filter: drop-shadow(0 6px 10px rgba(0,0,0,.28)); animation: dudu-bob 3.8s ease-in-out infinite; }
.dudu.acting .dudu-stage img { animation: none; }
.dudu-bar { display: flex; align-items: center; justify-content: flex-end; gap: 6px; padding: 4px 6px 5px 9px; border-top: 1px solid var(--line); background: color-mix(in oklab, var(--panel) 92%, var(--bg)); }
.dudu-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 2px color-mix(in oklab, var(--ok) 18%, transparent); animation: dudu-pulse 2.4s ease-in-out infinite; }
.dudu-x { width: 18px; height: 18px; padding: 0; border: 1px solid transparent; border-radius: 3px; background: transparent; color: var(--muted); font-size: 14px; line-height: 1; cursor: pointer; }
.dudu-x:hover { color: var(--fg); border-color: var(--line); background: color-mix(in oklab, var(--fg) 6%, transparent); }
.dudu-bubble { pointer-events: none; max-width: 200px; padding: 7px 10px; border: 1px solid color-mix(in oklab, var(--primary) 34%, var(--line)); border-radius: 5px; background: color-mix(in oklab, var(--panel) 96%, var(--bg)); color: var(--fg); font-size: 12px; line-height: 1.45; box-shadow: 0 8px 20px rgba(0,0,0,.22); position: relative; }
.dudu-bubble::after { content: ""; position: absolute; right: 18px; bottom: -5px; width: 8px; height: 8px; transform: rotate(45deg); border-right: 1px solid color-mix(in oklab, var(--primary) 34%, var(--line)); border-bottom: 1px solid color-mix(in oklab, var(--primary) 34%, var(--line)); background: inherit; }
.dudu-bubble.pop { animation: dudu-pop .22s ease; }
.dudu-restore { position: fixed; right: 20px; bottom: 18px; z-index: 1080; width: 46px; height: 46px; padding: 2px; border: 1px solid var(--line); border-radius: 50%; background: color-mix(in oklab, var(--panel) 96%, var(--bg)); box-shadow: 0 8px 20px rgba(0,0,0,.26); cursor: pointer; overflow: hidden; }
.dudu-restore img { width: 100%; height: 100%; object-fit: contain; display: block; }
.dudu-restore:hover { border-color: color-mix(in oklab, var(--primary) 45%, var(--line)); transform: translateY(-1px); }
@keyframes dudu-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes dudu-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes dudu-pop { from { opacity: 0; transform: translateY(4px) scale(.97); } to { opacity: 1; transform: none; } }
@media (max-width: 760px) {
  .dudu { right: 12px; bottom: 12px; }
  .dudu-card { width: 92px; }
  .dudu-stage { height: 96px; }
  .dudu-bubble { max-width: 160px; font-size: 11.5px; }
  .dudu-restore { right: 12px; bottom: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .dudu-stage img, .dudu-dot { animation: none; }
  .dudu-bubble.pop { animation: none; }
}
.dudu[hidden], .dudu-restore[hidden] { display: none !important; }

/* ---------- 功能详情与按应用范围 ---------- */
.rl-clickable { cursor: pointer; }
.feature-detail .field { margin-top: 10px; }
.feature-detail .kv:first-child { margin-top: -2px; }
.app-picker { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 3px; background: var(--panel-2); }
.app-picker:empty { display: none; }
.check.app-pick { color: var(--text); }
.check.app-pick .mono { font-size: 10.5px; }
