/* ═══════════════════════════════════════════════════════════════
   运营后台 · 设计令牌与组件样式
   依据：03-web 用户端 UI 规格（188 条令牌，事实源）+ openclaw-admin-console
   的成熟后台布局（侧栏/顶栏/卡片/表格/标签），本文件只保留后台需要的子集。
   规则：不新增品牌色；深色为 GitHub 色系（与用户端深色主题一致），浅色取用户端浅色令牌；
   警告色用同一色系内的 #d29922（用户端规格没有 warn 令牌，后台表格需要）。
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* 深色主题（取自 03-web UI 规格 §1.1 :root） */
  --bg: #0d1117;
  --bg-elev: #161b22;
  --bg-elev-2: #21262d;
  --text: #e6edf3;
  --text-2: #7d8590;
  --border: #30363d;
  --border-strong: #3d444d;
  --accent: #2d4fd6;
  --accent-hover: #1f3bb3;
  --accent-soft: rgba(45, 79, 214, 0.18);
  --accent-softer: rgba(45, 79, 214, 0.1);
  --danger: #f85149;
  --danger-soft: rgba(248, 81, 73, 0.15);
  --ok: #10b981;
  --ok-soft: rgba(16, 185, 129, 0.15);
  --warn: #d29922;
  --warn-soft: rgba(210, 153, 34, 0.15);
  --hover: rgba(255, 255, 255, 0.05);

  /* 字体与尺寸（§1.3 / §1.4 / §1.6） */
  --font: 'Segoe UI', system-ui, -apple-system, 'Microsoft YaHei', sans-serif;
  --mono: 'Courier New', monospace;
  --r-sm: 4px;
  --r: 6px;
  --r-lg: 8px;
  --r-xl: 12px;
  --r-pill: 999px;
  --sider-w: 224px;
  --topbar-h: 56px;

  /* 阴影与焦点环（§1.5 的常用档位） */
  --shadow-1: 0 1px 4px rgba(0, 0, 0, 0.2);
  --shadow-2: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-3: 0 10px 25px rgba(0, 0, 0, 0.2);
  --focus-ring: 0 0 0 3px rgba(45, 79, 214, 0.25);
  --transition: 0.2s ease;
}

/* 浅色主题（取自 03-web UI 规格 §1.1 [data-theme="light"]） */
[data-theme='light'] {
  --bg: #ffffff;
  --bg-elev: #f7f9fc;
  --bg-elev-2: #e8ecf1;
  --text: #1a1f36;
  --text-2: #6b7280;
  --border: #e1e6ef;
  --border-strong: #d3dae6;
  --accent: #3d62f5;
  --accent-hover: #2d4fd6;
  --accent-soft: rgba(61, 98, 245, 0.12);
  --accent-softer: rgba(61, 98, 245, 0.08);
  --danger: #d1242f;
  --danger-soft: rgba(209, 36, 47, 0.1);
  --ok: #0f9d63;
  --ok-soft: rgba(15, 157, 99, 0.12);
  --warn: #b45309;
  --warn-soft: rgba(180, 83, 9, 0.12);
  --hover: rgba(0, 0, 0, 0.05);
  --shadow-1: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-2: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-3: 0 10px 25px rgba(0, 0, 0, 0.15);
  --focus-ring: 0 0 0 3px rgba(61, 98, 245, 0.22);
}

/* ── 基础 ── */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.5 var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--transition), color var(--transition);
}
h1, h2, h3 { margin: 0; font-weight: 600; }
h3 { margin: 22px 0 10px; font-size: 14px; color: var(--text); }
.page > h3:first-child { margin-top: 0; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.hidden { display: none !important; }
.muted { color: var(--text-2); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-2); }

/* ── 登录页 ── */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1100px 520px at 18% 0%, var(--accent-softer), transparent 62%),
    var(--bg);
}
.login-card {
  width: min(400px, 100%);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 28px;
  box-shadow: var(--shadow-3);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-brand h1 { font-size: 18px; }
.login-brand .muted { margin: 4px 0 0; font-size: 12px; }
.brand-mark {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  box-shadow: 0 4px 12px var(--accent-soft);
}
.brand-mark svg { width: 20px; height: 20px; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; margin-bottom: 6px; font-size: 12px; color: var(--text-2); }
.field input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.msg { min-height: 18px; margin-top: 10px; font-size: 12px; color: var(--danger); }
.login-foot { margin-top: 16px; font-size: 11px; text-align: center; }

/* ── 主框架：侧栏 + 顶栏 + 内容 ── */
.app { display: flex; min-height: 100vh; }
.sider {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sider-w);
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  z-index: 30;
  transition: transform var(--transition), background-color var(--transition);
}
.sider-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.sider-brand .brand-mark { width: 30px; height: 30px; border-radius: 8px; }
.sider-brand .brand-mark svg { width: 17px; height: 17px; }
.sider-brand b { display: block; font-size: 14px; line-height: 1.25; letter-spacing: 0.2px; }
.sider-brand small { display: block; font-size: 11px; color: var(--text-2); }
.tabs { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 10px 8px; overflow: auto; }
.tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background-color var(--transition), color var(--transition);
}
.tab svg { width: 18px; height: 18px; flex: none; opacity: 0.9; }
.tab:hover { background: var(--hover); color: var(--text); }
.tab.active { background: var(--accent-soft); color: var(--text); }
a.tab { text-decoration: none; }
.tab.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.sider-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-2);
}
.sider-env { color: var(--ok); }

.main {
  flex: 1;
  min-width: 0;
  min-height: 100vh;
  margin-left: var(--sider-w);
  display: flex;
  flex-direction: column;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  transition: background-color var(--transition);
}
.page-heading { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.page-heading h1 { font-size: 18px; }
.page-sub { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.who-name { font-size: 12px; color: var(--text-2); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--r);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background-color var(--transition), color var(--transition);
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
#sider-toggle { display: none; }
.icon-sun { display: none; }
[data-theme='light'] .icon-sun { display: block; }
[data-theme='light'] .icon-moon { display: none; }

.perm-banner {
  padding: 8px 20px;
  font-size: 12px;
  color: var(--warn);
  background: var(--warn-soft);
  border-bottom: 1px solid var(--border);
}
.content {
  flex: 1;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 24px 40px;
}

/* ── 按钮（§1.4 默认圆角 6；主按钮只用于主动作） ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg-elev-2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
}
.btn:hover { border-color: var(--border-strong); }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { height: 26px; padding: 0 8px; font-size: 12px; border-radius: var(--r-sm); }
.btn.block { width: 100%; height: 38px; }

/* ── 工具条 / 表单控件 ── */
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.toolbar input,
.toolbar select,
.inline-field input {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.toolbar input[type='search'] { min-width: 200px; }
.toolbar input[type='datetime-local'] { min-width: 182px; color: var(--text-2); }
.toolbar input:focus,
.toolbar select:focus,
.inline-field input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.toolbar input::placeholder { color: var(--text-2); opacity: 0.75; }
.inline-field { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.inline-field input { width: 96px; }

/* ── 表格（成熟后台：卡片包裹 + 吸顶表头 + 行悬停） ── */
.table-wrap {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: auto;
  box-shadow: var(--shadow-1);
  transition: background-color var(--transition);
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-elev-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--hover); }
td.body { max-width: 420px; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.row-bad td { background: var(--danger-soft); }
.row-bad:hover td { background: var(--danger-soft); }
.cell-wrap { white-space: normal; word-break: break-word; max-width: 320px; color: var(--text-2); font-size: 12px; line-height: 1.5; }
.code-chip {
  display: inline-block;
  margin-right: 6px;
  padding: 0 6px;
  border: 1px solid var(--danger);
  border-radius: var(--r-sm);
  color: var(--danger);
  font-size: 10px;
}
.pager { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 12px; color: var(--text-2); }

/* ── 徽章 / 角色标签 ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  color: var(--text-2);
  font-size: 11px;
  line-height: 18px;
  white-space: nowrap;
}
.badge.ok { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.badge.bad { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.badge.warn { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.badge.mismatch { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.badge.role-readonly { color: var(--text-2); }
.badge.role-operator { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.badge.role-super { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.role {
  display: inline-block;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  font-size: 10px;
  line-height: 18px;
}
.role.user { color: var(--accent); border-color: var(--accent); }
.role.agent { color: var(--ok); border-color: var(--ok); }

/* ── 指标卡 ── */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-1);
  transition: background-color var(--transition);
}
.card .k { font-size: 12px; color: var(--text-2); }
.card .v { margin-top: 6px; font-size: 26px; font-weight: 600; letter-spacing: -0.01em; }

/* ── 说明条（审计上限 / 配额口径） ── */
.hint {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r);
  background: var(--bg-elev);
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.7;
}
.hint b { color: var(--text); font-weight: 600; }
.hint .badge { margin-left: 8px; }
.quota-detail {
  min-height: 38px;
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg-elev);
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.7;
}
.quota-detail b { color: var(--text); }
.quota-detail .btn { margin-left: 8px; }

/* ── 机器人可见性 ── */
.vis-cell .raw { color: var(--text-2); font-size: 11px; white-space: normal; }
.vis-edit select {
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 12px;
}
.vis-edit select:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.vis-edit .btn { height: 28px; padding: 0 8px; font-size: 12px; border-radius: var(--r-sm); }

/* ── 会话页 ── */
.conv-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 44%); gap: 14px; align-items: start; }
.conv-list { max-height: calc(100vh - 220px); overflow: auto; }
.conv-list table { table-layout: fixed; }
.conv-list th:nth-child(1), .conv-list td:nth-child(1) { width: 132px; }
.conv-list th:nth-child(2), .conv-list td:nth-child(2) { width: 184px; }
.conv-list th:nth-child(3), .conv-list td:nth-child(3) { width: 62px; }
.conv-list td.snippet { white-space: normal; color: var(--text-2); }
.conv-list tbody tr { cursor: pointer; }
.conv-list tbody tr.active td { background: var(--accent-soft); }
.snippet-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.conv-detail {
  max-height: calc(100vh - 220px);
  overflow: auto;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg-elev);
  box-shadow: var(--shadow-1);
}
.conv-detail h4 { margin: 0 0 4px; font-size: 14px; }
.conv-detail .meta { margin-bottom: 10px; font-size: 12px; color: var(--text-2); }
.conv-msg { padding: 10px 0; border-top: 1px dashed var(--border); }
.conv-msg:first-of-type { border-top: 0; }
.conv-msg .head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 11px; color: var(--text-2); }
.conv-msg .body { white-space: pre-wrap; word-break: break-word; font-size: 13px; line-height: 1.65; }

/* ── Toast（成熟后台：右上角滑入） ── */
.toast {
  position: fixed;
  top: 70px; /* 避开 56px 顶栏 */
  right: 20px;
  z-index: 100;
  max-width: 420px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-lg);
  background: var(--bg-elev-2);
  color: var(--text);
  font-size: 13px;
  box-shadow: var(--shadow-3);
  animation: toast-in 0.2s ease;
}
.toast.err { border-left-color: var(--danger); color: var(--danger); }
@keyframes toast-in {
  from { transform: translateX(16px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ── 用户详情抽屉（v0.9.5，点用户名打开）── */
.drawer-mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  justify-content: flex-end;
  background: rgba(0, 0, 0, 0.45);
}
.drawer {
  display: flex;
  flex-direction: column;
  width: min(460px, 100%);
  height: 100%;
  border-left: 1px solid var(--border);
  background: var(--bg-elev);
  box-shadow: var(--shadow-2);
  animation: drawer-in 0.18s ease;
}
@keyframes drawer-in {
  from { transform: translateX(24px); opacity: 0.4; }
  to { transform: none; opacity: 1; }
}
.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.drawer-head h2 { margin: 0; font-size: 15px; }
.drawer-sub { margin: 2px 0 0; color: var(--text-2); font-size: 11px; }
.drawer-body { flex: 1; overflow: auto; padding: 16px 18px; }
.drawer-sec { margin-bottom: 18px; }
.drawer-sec h3 { margin: 0 0 8px; color: var(--text-2); font-size: 12px; font-weight: 600; }
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 6px 10px; margin: 0; font-size: 12px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; }
.pill-row { display: flex; flex-wrap: wrap; gap: 6px; }
.link-btn { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; text-align: left; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.log-mini { margin: 0; padding: 0; list-style: none; font-size: 12px; }
.log-mini li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.log-mini .muted { font-size: 11px; }

/* ── 用量页图表 + 加载骨架（v0.9.4，零依赖 SVG）── */
.charts {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 12px;
  margin: 0 0 6px;
}
@media (max-width: 1100px) {
  .charts { grid-template-columns: minmax(0, 1fr); }
}
.chart-card {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg-elev);
  box-shadow: var(--shadow-1);
}
.chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.chart-head h3 { margin: 0; font-size: 13px; }
.chart-head .muted { font-size: 11px; }
.chart-body { min-height: 180px; }
.chart-body svg { display: block; width: 100%; height: auto; }
.chart-empty { display: grid; place-items: center; min-height: 170px; margin: 0; color: var(--text-2); font-size: 12px; }
.hbar { display: grid; grid-template-columns: minmax(84px, 132px) 1fr auto; gap: 8px; align-items: center; margin: 7px 0; font-size: 12px; }
.hbar-label { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 8px; overflow: hidden; border-radius: var(--r-pill); background: var(--bg-elev-2); }
.hbar-fill { height: 100%; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--accent), var(--accent-hover)); }
.hbar-val { color: var(--text-2); font-variant-numeric: tabular-nums; text-align: right; }
.sk-card, .sk-chart {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: linear-gradient(90deg, var(--bg-elev) 25%, var(--bg-elev-2) 37%, var(--bg-elev) 63%);
  background-size: 400% 100%;
  animation: sk-shimmer 1.2s ease infinite;
}
.sk-card { height: 86px; }
.sk-chart { height: 170px; }
@keyframes sk-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* ── 全局加载条（v0.8.1：请求进行中在顶栏下方走一条进度带）── */
.load-bar {
  position: fixed;
  top: var(--topbar-h);
  left: var(--sider-w);
  right: 0;
  height: 2px;
  z-index: 40;
  overflow: hidden;
  background: var(--accent-softer);
}
.load-bar::before {
  content: '';
  display: block;
  width: 36%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: load-bar-move 1s linear infinite;
}
@keyframes load-bar-move {
  from { transform: translateX(-100%); }
  to { transform: translateX(360%); }
}

/* ── 关系视图面板（v0.8.0，桌面宽面板）── */
.panel-mask {
  position: fixed;
  inset: 0;
  z-index: 115;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.5);
}
.panel {
  width: min(760px, 100%);
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--bg-elev);
  box-shadow: var(--shadow-3);
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.panel-head h2 { font-size: 16px; }
.panel-sub { margin: 4px 0 0; font-size: 12px; color: var(--text-2); }
.panel-body { padding: 14px 20px 20px; overflow: auto; }
.rel-group { margin-bottom: 18px; }
.rel-group:last-child { margin-bottom: 0; }
.rel-title { margin: 0 0 8px; font-size: 13px; color: var(--text); }
.rel-title .badge { margin-left: 6px; }
.rel-list { list-style: none; margin: 0; padding: 0; }
.rel-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg);
  margin-bottom: 6px;
}
.rel-main { font-size: 13px; word-break: break-all; }
.rel-main code { font-family: var(--mono); font-size: 11px; color: var(--text-2); }
.rel-meta { font-size: 11px; color: var(--text-2); text-align: right; white-space: nowrap; }
.rel-meta .badge { margin-left: 6px; }
.rel-empty { font-size: 12px; color: var(--text-2); margin: 0 0 6px; padding-left: 2px; }

/* ── 自定义弹层（v0.7.3：替代 window.prompt/confirm，借用户端 confirm 样式） ── */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.5);
}
.modal {
  width: min(440px, 100%);
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--bg-elev);
  box-shadow: var(--shadow-3);
}
.modal h2 { font-size: 16px; }
.modal-desc { margin: 8px 0 14px; color: var(--text-2); font-size: 12px; line-height: 1.7; white-space: pre-line; }
.modal .field { margin: 0 0 14px; }
.modal .field span { display: block; margin-bottom: 6px; font-size: 12px; color: var(--text-2); }
.modal .field input,
.modal .field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.modal .field input { height: 36px; padding: 0 10px; }
.modal .field textarea { padding: 8px 10px; min-height: 76px; resize: vertical; line-height: 1.6; }
.modal .field input:focus,
.modal .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.modal .msg { min-height: 0; margin: 0 0 8px; }
.modal-acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* ── 响应式：窄屏侧栏抽屉（借 openclaw-admin-console 的布局做法） ── */
.sider-mask { display: none; }
@media (max-width: 900px) {
  .sider { transform: translateX(-100%); }
  .sider.open { transform: translateX(0); box-shadow: var(--shadow-3); }
  .sider-mask {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(0, 0, 0, 0.5);
  }
  .main { margin-left: 0; }
  #sider-toggle { display: inline-grid; }
  .topbar { padding: 0 12px; }
  .content { padding: 16px; }
  .page-sub { display: none; }
  .conv-layout { grid-template-columns: minmax(0, 1fr); }
  .conv-list, .conv-detail { max-height: 52vh; }
}
@media (max-width: 600px) {
  .toolbar input[type='search'], .toolbar input[type='datetime-local'] { min-width: 0; width: 100%; }
  .who-name { display: none; }
  .content { padding: 12px; }
}
