:root {
  --bg: #f3f6fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #d9e2ef;
  --line-strong: #bdcbe0;
  --text: #101827;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --nav: #071523;
  --nav-2: #09203a;
  --blue: #1463ff;
  --blue-soft: #e8f0ff;
  --green: #0f9f5f;
  --green-soft: #e8f8ef;
  --orange: #f08a00;
  --orange-soft: #fff4df;
  --red: #e33636;
  --red-soft: #fff0f0;
  --purple: #6a4df4;
  --purple-soft: #f0edff;
  --teal: #0891a6;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background: var(--bg);
  font-family: "PingFang SC", "Microsoft YaHei", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #fff;
  min-height: 36px;
  border-radius: 5px;
  padding: 0 16px;
  cursor: pointer;
  white-space: nowrap;
}

button:hover {
  filter: brightness(0.96);
}

button.secondary {
  background: #fff;
  color: #1654c8;
  border-color: #b9cef9;
}

button.danger {
  background: #fff;
  color: var(--red);
  border-color: var(--red);
}

button.success {
  background: #fff;
  color: var(--green);
  border-color: #9ed9ba;
}

button.text-button {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue);
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(20, 99, 255, 0.08), transparent 40%),
    var(--bg);
}

.login-panel {
  width: min(420px, calc(100vw - 32px));
  display: grid;
  gap: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px;
}

.login-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #fff;
  background: var(--blue);
  font-weight: 800;
}

.login-copy h1,
.topbar h1,
.section-head h2 {
  margin: 0;
}

.login-copy p,
.topbar p,
.section-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

label {
  display: grid;
  gap: 7px;
  color: #243044;
  font-size: 13px;
  min-width: 0;
}

label span {
  color: var(--red);
  font-size: 12px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd7e8;
  border-radius: 5px;
  background: #fff;
  min-height: 36px;
  padding: 8px 10px;
  color: var(--text);
}

textarea {
  min-height: 88px;
  resize: vertical;
}

.inline-status {
  color: var(--muted);
  font-size: 12px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 64px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: linear-gradient(180deg, var(--nav), var(--nav-2));
  color: #d9e8ff;
  padding: 20px 10px 18px;
}

.brand {
  display: grid;
  gap: 10px;
  padding: 6px 10px 24px;
}

.brand strong {
  color: #fff;
  font-size: 16px;
}

.brand span {
  color: #8da4bf;
  font-size: 12px;
}

.side-nav {
  display: grid;
  align-content: start;
  gap: 8px;
}

.nav-item {
  min-height: 42px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: #d7e5f7;
  background: transparent;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 10px 24px rgba(20, 99, 255, 0.3);
}

.nav-icon {
  width: 16px;
  height: 16px;
  position: relative;
  display: inline-block;
  color: currentColor;
}

.nav-icon::before,
.nav-icon::after {
  content: "";
  position: absolute;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.nav-icon-workbench::before { inset: 2px; transform: rotate(45deg); }
.nav-icon-customer::before { width: 10px; height: 6px; left: 1px; top: 8px; border-radius: 8px 8px 2px 2px; }
.nav-icon-customer::after { width: 6px; height: 6px; left: 4px; top: 0; border-radius: 50%; }
.nav-icon-subscription::before { width: 12px; height: 8px; left: 1px; top: 1px; border-radius: 3px 3px 0 0; }
.nav-icon-subscription::after { width: 8px; height: 2px; left: 3px; bottom: 1px; border-radius: 2px; }
.nav-icon-skill::before { inset: 2px; }
.nav-icon-mcp::before { width: 6px; height: 6px; left: 0; top: 5px; border-radius: 50%; }
.nav-icon-mcp::after { width: 6px; height: 6px; right: 0; top: 5px; border-radius: 50%; }
.nav-icon-content::before { inset: 1px 3px; }
.nav-icon-log::before { inset: 2px; border-radius: 50%; }
.nav-icon-account::before { width: 8px; height: 8px; left: 4px; top: 0; border-radius: 50%; }
.nav-icon-account::after { width: 12px; height: 5px; left: 2px; top: 10px; border-radius: 10px 10px 2px 2px; }

.collapse-btn {
  justify-self: stretch;
  border: 0;
  background: transparent;
  color: #c7d7ea;
  text-align: left;
  padding-left: 12px;
}

.sidebar .brand,
.sidebar .nav-label {
  transition: opacity 0.16s ease;
}

.app-shell.sidebar-collapsed .sidebar {
  padding-inline: 8px;
}

.app-shell.sidebar-collapsed .brand strong,
.app-shell.sidebar-collapsed .brand span,
.app-shell.sidebar-collapsed .nav-label {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.app-shell.sidebar-collapsed .brand {
  min-height: 42px;
  padding: 6px 0 16px;
}

.app-shell.sidebar-collapsed .nav-item {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 0;
}

.app-shell.sidebar-collapsed .collapse-btn {
  text-align: center;
  padding-left: 0;
}

.shell {
  min-width: 0;
  padding: 0 16px 28px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(243, 246, 251, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  font-size: 22px;
}

.admin-session {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-session span {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 7px 12px;
}

.page {
  display: none;
  padding-top: 16px;
  position: relative;
}

.page.active {
  display: block;
}

/* 三页性能优化：加载中给轻量遮罩 + 提示，不清空旧内容 */
.page[aria-busy="true"]::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(248, 250, 252, 0.72);
  backdrop-filter: blur(1px);
  pointer-events: none;
}

.page[aria-busy="true"]::after {
  content: "正在加载最新数据…";
  position: absolute;
  top: 16px;
  right: 20px;
  z-index: 21;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  box-shadow: 0 4px 14px rgba(30, 41, 59, 0.08);
}

.page-tabs {
  display: flex;
  gap: 24px;
  min-height: 42px;
  align-items: end;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.page-tabs button {
  color: #142033;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0 4px 12px;
  min-height: auto;
}

.page-tabs button.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  font-weight: 700;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 14px;
}

.filter-bar label {
  flex: 1 1 150px;
  max-width: 220px;
}

.filter-bar button {
  flex: 0 0 auto;
}

.filter-bar.compact {
  padding: 10px;
}

.filter-bar.slim {
  justify-content: flex-end;
  padding: 8px 12px;
}

.search-field {
  flex: 2 1 200px;
  max-width: none;
  min-width: 0;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric-card {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.metric-card span,
.metric-card small {
  color: var(--muted);
}

.metric-card strong {
  display: block;
  margin: 6px 0;
  font-size: 28px;
  line-height: 1;
  font-weight: 700;
}

.metric-icon {
  min-width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  font-size: 14px;
}

.tone-blue .metric-icon { color: var(--blue); background: var(--blue-soft); }
.tone-green .metric-icon { color: var(--green); background: var(--green-soft); }
.tone-orange .metric-icon { color: var(--orange); background: var(--orange-soft); }
.tone-red .metric-icon { color: var(--red); background: var(--red-soft); }
.tone-purple .metric-icon { color: var(--purple); background: var(--purple-soft); }
.tone-teal .metric-icon { color: var(--teal); background: #e6f8fb; }

.page-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.span-5 { grid-column: span 5; }
.span-7 { grid-column: span 7; }
.span-12 { grid-column: span 12; }

.workspace-card,
.drawer-panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
}

.list-pane,
.tree-pane,
.content-editor,
.content-status {
  content-visibility: auto;
  contain-intrinsic-size: 320px;
}

.workspace-card.nested-card {
  margin-top: 14px;
  padding: 12px;
  background: var(--panel-soft);
}

.list-pane {
  overflow-x: hidden;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head h2 {
  font-size: 16px;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  gap: 14px;
}

.three-column-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 420px;
  gap: 14px;
  margin-bottom: 14px;
}

.content-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 440px;
  gap: 14px;
  margin-bottom: 14px;
}

.drawer-panel {
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 96px);
  overflow: auto;
}

.drawer-panel:not(.open),
.drawer-panel[aria-hidden="true"] {
  display: none;
}

.drawer-panel.open {
  display: block;
}

.icon-button {
  width: 32px;
  min-height: 32px;
  padding: 0;
  background: #fff;
  color: #31415b;
  border-color: var(--line);
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.compact-table-wrap {
  max-height: 460px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  background: #fff;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid #e6edf6;
  padding: 11px 12px;
  text-align: left;
  vertical-align: middle;
  /* 默认不换行：避免日期/按钮被折成竖排；长文本列用 .wrap 白名单放开 */
  white-space: nowrap;
}

.data-table td.wrap {
  white-space: normal;
  min-width: 200px;
  max-width: 340px;
}

.data-table small {
  white-space: normal;
}

/* 操作列固定在可视区右缘：表格横向滚动时按钮始终可点 */
.data-table th:last-child,
.data-table td:last-child {
  position: sticky;
  right: 0;
  background: #fff;
  box-shadow: -10px 0 10px -10px rgba(15, 23, 42, 0.22);
}

.data-table th:last-child {
  background: #fbfdff;
}

.data-table tr.selected td:last-child,
.data-table tbody tr:hover td:last-child {
  background: #f1f6ff;
}

.data-table th {
  color: #334155;
  font-weight: 700;
  background: #fbfdff;
  white-space: nowrap;
}

.data-table tr.selected td,
.data-table tbody tr:hover td {
  background: #f1f6ff;
}

.data-table strong,
.data-table small {
  display: block;
}

.data-table small {
  margin-top: 3px;
  color: var(--muted);
}

/* 操作列不能用 display:flex：td 变成 flex 容器后 sticky 背景铺不满整格，
   底层列文字会透出来。保持 table-cell + inline 按钮排布。 */
.table-actions {
  white-space: nowrap;
}

.table-actions button + button {
  margin-left: 8px;
}

.status-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 12px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.status-tag.success { color: var(--green); background: var(--green-soft); border-color: #bce9cf; }
.status-tag.danger { color: var(--red); background: var(--red-soft); border-color: #ffc7c7; }
.status-tag.warning { color: var(--orange); background: var(--orange-soft); border-color: #ffd9a0; }
.status-tag.blue { color: var(--blue); background: var(--blue-soft); border-color: #bcd1ff; }
.status-tag.neutral { color: #42526a; background: #eef3f9; border-color: #d5e0ed; }

.stack-form {
  display: grid;
  gap: 14px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
}

.wide-field {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

.status-pane .form-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.step-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.step-line b {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
}

.info-note,
.status-boundary,
.risk-note {
  border: 1px solid #cfe0ff;
  background: #f2f6ff;
  color: #36527a;
  border-radius: 6px;
  padding: 11px 12px;
  line-height: 1.55;
}

.status-boundary.success {
  border-color: #aee4c9;
  background: var(--green-soft);
  color: #176b44;
}

.risk-note {
  border-color: #ffd9a0;
  background: var(--orange-soft);
  color: #8a4d00;
}

.mcp-user-guide {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdff;
  padding: 12px;
  color: var(--text);
}

.mcp-user-guide strong {
  display: block;
  margin-bottom: 6px;
}

.mcp-user-guide ol {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.6;
}

.mcp-user-guide code {
  color: var(--blue);
  word-break: break-all;
}

.donut-row {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.donut-ring {
  width: 152px;
  height: 152px;
  display: grid;
  place-items: center;
  text-align: center;
  border-radius: 50%;
  /* 兜底为灰环；真实占比由 workbench.js 按数据以内联 conic-gradient 写入 */
  background:
    radial-gradient(circle at center, #fff 0 48%, transparent 49%),
    conic-gradient(#cbd5e1 0 100%);
}

.donut-ring strong {
  display: block;
  font-size: 24px;
}

.status-list {
  display: grid;
  gap: 8px;
}

.status-list div {
  display: grid;
  grid-template-columns: 14px 1fr auto auto;
  gap: 10px;
  align-items: center;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot.green { background: var(--green); }
.dot.blue { background: var(--blue); }
.dot.orange { background: var(--orange); }
.dot.red { background: var(--red); }
.dot.neutral { background: var(--muted-2); }

.line-chart {
  position: relative;
  height: 190px;
  display: flex;
  align-items: end;
  gap: 18px;
  padding: 20px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: repeating-linear-gradient(to top, #fff, #fff 31px, #eef3f9 32px);
}

.line-chart i {
  flex: 1;
  border-radius: 999px 999px 0 0;
  background: linear-gradient(180deg, var(--blue), #77a7ff);
}

.line-chart i.zero {
  background: #dbe6f5;
  border-radius: 2px;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}

.axis-row {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  color: var(--muted-2);
  font-size: 12px;
}

.table-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.table-pager button {
  min-height: 30px;
  padding: 0 12px;
}

.table-pager button[disabled] {
  opacity: 0.45;
  cursor: default;
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline div {
  position: relative;
  padding-left: 20px;
}

.timeline div::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--blue);
}

.timeline.compact div {
  padding-bottom: 4px;
}

.timeline time {
  color: var(--muted);
  font-size: 12px;
}

.timeline strong,
.timeline p {
  display: block;
  margin: 2px 0;
}

.opening-customer-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 14px;
}

.opening-customer-card small {
  color: var(--muted);
}

.access-choice-row,
.mcp-choice-grid,
.permission-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.mcp-choice-grid {
  /* 客户端类型收敛为 WorkBuddy / QoderWork，两列即可 */
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* 客户列表的客户选择控件：全局 input 100%/36px 规则会把 radio 撑满整格，
   这里用专属类收敛为 16px，整行点击选择由 data-mcp-id 行监听保证。 */
.mcp-customer-choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  cursor: pointer;
}

.mcp-customer-choice input[type="radio"] {
  width: 16px;
  height: 16px;
  min-height: 0;
  flex: 0 0 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--blue);
}

.mcp-customer-choice span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.choice-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #fff;
}

.choice-card.active {
  border-color: var(--blue);
  background: #f5f8ff;
}

.choice-card input {
  width: auto;
  min-height: auto;
}

.choice-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.skill-tree {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  max-height: 620px;
  overflow: auto;
}

.skill-tree details {
  border-left: 1px solid var(--line);
  padding-left: 10px;
}

.skill-tree summary {
  cursor: pointer;
  color: #243044;
  min-height: 28px;
}

.skill-tree button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 4px 0;
  border: 1px solid transparent;
  background: #fff;
  color: #21314a;
  text-align: left;
}

.skill-tree button.active,
.skill-tree button:hover {
  background: var(--blue-soft);
  border-color: #b9cef9;
  color: var(--blue);
}

.skill-tree button span {
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 50%;
}

.full-input {
  width: 100%;
}

.keyword-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.keyword-row span {
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 5px;
  padding: 7px 10px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 14px;
  overflow: hidden;
}

.status-grid div {
  padding: 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.status-grid div:nth-child(2n) {
  border-right: 0;
}

.status-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.status-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.json-preview {
  min-height: 240px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  background: #fbfdff;
}

.content-preview {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdff;
  padding: 12px;
}

.content-preview pre {
  margin: 8px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.toast-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
}

.toast-item {
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 11px 12px;
  line-height: 1.5;
}

.toast-item.success { border-left-color: var(--green); }
.toast-item.warning { border-left-color: var(--orange); }
.toast-item.danger { border-left-color: var(--red); }

.content-column {
  width: 100%;
  min-height: 96px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 10px;
  justify-items: start;
  margin-bottom: 10px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  text-align: left;
}

.content-column.active {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.content-column small {
  color: var(--muted);
}

.progress-line {
  height: 8px;
  border-radius: 999px;
  background: #e5edf7;
  overflow: hidden;
  margin: 14px 0;
}

.progress-line span {
  display: block;
  height: 100%;
  background: var(--blue);
}

.detail-list {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.detail-list dt,
.detail-list dd {
  margin: 0;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.detail-list dt {
  color: var(--muted);
  background: #fbfdff;
}

.detail-list dd {
  border-left: 1px solid var(--line);
}

.detail-raw {
  display: block;
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.chain-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
}

.chain-row span {
  min-height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  text-align: center;
  padding: 4px 6px;
  font-size: 12px;
  overflow: hidden;
  word-break: break-word;
}

.chain-row .done {
  color: var(--green);
  background: var(--green-soft);
  border-color: #bce9cf;
}

.chain-row .pending {
  color: var(--orange);
  background: var(--orange-soft);
  border-color: #ffd9a0;
}

.chain-row .risk {
  color: var(--red);
  background: var(--red-soft);
  border-color: #ffc7c7;
}

.account-top-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.person-list {
  display: grid;
  gap: 8px;
}

.person-list button {
  display: grid;
  grid-template-columns: 14px 90px 1fr 110px auto;
  gap: 14px;
  align-items: center;
  min-height: 58px;
  background: #fff;
  color: var(--text);
  border-color: transparent;
  text-align: left;
}

.person-list button.active,
.person-list button:hover {
  background: var(--blue-soft);
  border-color: #bad0ff;
}

.person-list button span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #cbd5e1;
}

.person-list button.active span {
  background: var(--blue);
}

.person-list small {
  color: var(--muted);
}

.person-list button strong,
.person-list button small,
.person-list button b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.person-list .status-tag {
  justify-self: end;
  max-width: 100%;
  overflow: hidden;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.permission-card {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #fbfdff;
}

.permission-card input,
.permission-row input {
  width: auto;
  min-height: auto;
}

.scope-note {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.empty-state {
  padding: 22px;
  text-align: center;
  color: var(--muted);
}

.empty-state strong {
  display: block;
  color: var(--text);
  margin-bottom: 4px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 148px minmax(0, 1fr);
  }

  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .filter-bar,
  .filter-bar.compact,
  .three-column-layout,
  .content-layout,
  .split-layout {
    grid-template-columns: 1fr;
  }

  .drawer-panel {
    position: static;
    max-height: none;
  }

  .span-5,
  .span-7,
  .span-12 {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .side-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .shell {
    padding: 0 10px 20px;
  }

  .topbar {
    position: static;
    height: auto;
    padding: 14px 0;
    align-items: start;
    gap: 12px;
    flex-direction: column;
  }

  .metric-grid,
  .grid-2,
  .mcp-choice-grid,
  .access-choice-row,
  .permission-grid,
  .status-grid,
  .chain-row {
    grid-template-columns: 1fr;
  }

  .page-tabs {
    overflow: auto;
  }

  .filter-bar,
  .filter-bar.compact {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    max-width: 100%;
  }

  .data-table {
    min-width: 0;
    table-layout: fixed;
    font-size: 12px;
  }

  .data-table th,
  .data-table td,
  .status-tag,
  button {
    white-space: normal;
    word-break: break-word;
  }

  .data-table th,
  .data-table td {
    padding: 8px 6px;
  }

  .form-actions,
  .table-actions {
    flex-wrap: wrap;
  }

  .donut-row {
    grid-template-columns: 1fr;
  }

  .person-list button {
    grid-template-columns: 12px 1fr auto;
  }

  .person-list button small,
  .person-list button b {
    display: none;
  }
}

/* demo-only: marks UI blocks shown as preview, not yet wired to the backend.
   Keeps them visible for product preview but signals they are non-functional. */
.demo-only {
  opacity: 0.85;
}
.demo-only .choice-card,
.demo-only label {
  cursor: not-allowed;
}
.config-preview-note {
  margin: 0.25rem 0 0.5rem;
  color: var(--text-muted, #8a8f98);
  font-size: 0.78rem;
}
.config-preview-note small {
  display: inline;
}

/* 多选标签组（行业标签 / B 包行业库，20260706） */
.checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.checkbox-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid #d7deeb;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
  background: #fff;
  color: #33415c;
}
.checkbox-chip input {
  margin: 0;
  accent-color: #1463ff;
}
.checkbox-chip:has(input:checked) {
  border-color: #1463ff;
  background: #eef4ff;
  color: #1245c4;
  font-weight: 600;
}

/* 开通页重构（20260706）：步骤标题 / 下拉式多选 / 开通材料区 */
.step-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: #1f2b45;
}
.step-title b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #1463ff;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.field-block { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 600; color: #33415c; display: flex; flex-direction: column; gap: 2px; }
.field-hint { font-size: 12px; font-weight: 400; color: #8a94a8; }
.multi-select { position: relative; }
.multi-select summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 34px 10px 12px;
  border: 1px solid #d7deeb;
  border-radius: 10px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2333415c' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  font-size: 14px;
  color: #33415c;
  user-select: none;
}
.multi-select summary::-webkit-details-marker { display: none; }
.multi-select[open] summary { border-color: #1463ff; }
.multi-select-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid #d7deeb;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(20, 40, 90, 0.14);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.multi-select-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}
.multi-select-option:hover { background: #f2f6ff; }
.multi-select-option input { margin: 0; accent-color: #1463ff; }
.material-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #e3e9f4;
  border-radius: 10px;
  margin-bottom: 10px;
  background: #fbfcff;
}
.material-row strong { display: block; font-size: 14px; color: #1f2b45; }
.material-row small { color: #8a94a8; font-size: 12px; }
.material-actions { display: inline-flex; gap: 8px; }
.text-button {
  background: none;
  border: none;
  color: #1463ff;
  font-size: 13px;
  cursor: pointer;
  padding: 0 4px;
  text-decoration: underline;
}
.info-note.warn { border-left: 3px solid #f5a623; background: #fff8ec; }
#openingMaterialsPanel:not(:empty), #openingCaptureTestPanel:not(:empty) {
  display: block;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed #dfe6f2;
}

/* 阶段3 新客开通向导（工作台）：入口条 + 四步状态卡，复用现有配色 */
.wizard-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.wizard-entry span { font-size: 12px; color: #8a94a8; }
.wizard-panel { margin-bottom: 14px; }
.wizard-head-actions { display: flex; gap: 8px; align-items: center; }
.wizard-steps {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wizard-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #e3e9f4;
  border-radius: 12px;
  background: #fbfcff;
}
.wizard-step.done { border-color: #bfe4cf; background: #f2fbf6; }
.wizard-step-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #cbd5e1;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  flex: 0 0 auto;
}
.wizard-step.done .wizard-step-index { background: #0f9f5f; }
.wizard-step-body { flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; }
.wizard-step-body strong { font-size: 14px; color: #1f2b45; }
.wizard-step-body small { font-size: 12px; color: #8a94a8; }
.wizard-summary {
  margin: 4px 0 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #eef6ff;
  border: 1px solid #cfe0f7;
}
.wizard-summary strong { display: block; color: #1463ff; margin-bottom: 6px; }
.wizard-summary ul { margin: 0; padding-left: 18px; font-size: 13px; color: #33415c; }
