/*
 * example-admin-console-ui — 可复用后台样式（零外部依赖）
 *
 * 用法：复制到项目，只改下面 :root 里的品牌令牌。
 * 字体：@font-face 引用 ./fonts/example-cn-text-{regular,bold}.woff2；
 *       没有品牌字体就删掉这两个 @font-face 并把 --font 的第一项去掉。
 * 说明见同目录 ../SKILL.md。
 */

/*
 * Example 内容运营 Console —— macOS Fluid 风格（参考 ai-market-insight），主题色取自
 * 官网最新实现 src/styles/figma-ui.css / figma-parity.css（Figma EWadN8ikia4qz3AFs8pqMj）。
 *
 * 官网是营销页；后台是高密度工作界面。这里沿用官网的品牌紫、字体与浅紫底色，
 * 但按 ai-market-insight 的结构收紧：白色可折叠侧栏、52px 顶栏、14px 圆角白卡、
 * 分段控件、13px 基础字号、10px 圆角按钮。官网强制浅色，Console 同样只有浅色。
 */

:root {
  color-scheme: light;

  /* 官网 figma-ui.css 令牌 */
  --brand: #9e3cf8;
  --brand-strong: #8141b9;
  --brand-soft: #f0e0ff;
  --brand-wash: #faf5ff;
  --ink: #3a1d53;
  --ink-soft: #777;
  --line: #eedfff;

  /* 三级文字 */
  --t1: #3a1d53;
  --t2: #5f4a72;
  --t3: #9a8fa6;

  --surface: #ffffff;
  --page: #f7f2fc;           /* 偏紫的浅底，对应 ai-market-insight 的 #F0F2F5 */
  --hairline: rgba(58, 29, 83, 0.08);
  --danger: #b42339;
  --danger-bg: #fff1f2;
  --success: #1f6b47;
  --success-bg: #e8f6ee;
  --warn: #8a5a00;
  --warn-bg: #fff7e6;
  --neutral-bg: #f3eff7;

  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 12px;
  --r-xl: 14px;
  --r-btn: 10px;

  --shadow-sm: 0 0 0 .5px rgba(0, 0, 0, .06), 0 1px 3px rgba(0, 0, 0, .06), 0 2px 8px rgba(0, 0, 0, .04);
  --shadow-hover: 0 0 0 .5px rgba(0, 0, 0, .06), 0 6px 18px rgba(58, 29, 83, .10), 0 16px 40px rgba(58, 29, 83, .08);
  --shadow-pop: 0 0 0 .5px rgba(0, 0, 0, .08), 0 24px 70px rgba(58, 29, 83, .22);
  --ring: 0 0 0 3px rgba(158, 60, 248, .18);
  --lift: 380ms cubic-bezier(.34, 1.56, .64, 1);

  --header-height: 52px;
  --nav-width: 220px;
  --nav-collapsed: 64px;

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { background: var(--page); }

body {
  margin: 0;
  background: var(--page);
  color: var(--t1);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

:focus-visible { outline: none; box-shadow: var(--ring); }
[hidden] { display: none !important; }
h1, h2, h3, strong { font-weight: 700; }
code, pre, .mono { font-family: var(--mono); }

/* ------------------------------------------------------------------ topbar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px 0 14px;
  height: var(--header-height);
  background: #fff;   /* 原来是毛玻璃（backdrop-filter blur），下面内容一动就要重新模糊整条顶栏，忙的机器上切页、滚动会卡 */
  border-bottom: 1px solid var(--hairline);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; }

.nav-toggle {
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--t2);
  border: 0;
}
.nav-toggle:hover { background: rgba(158, 60, 248, .09); color: var(--brand); }
.nav-toggle svg { width: 18px; height: 18px; }

.brand { font-weight: 700; font-size: 14px; letter-spacing: -0.01em; color: var(--t1); }

.env-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  background: var(--brand-soft);
  color: var(--brand-strong);
  letter-spacing: 0.02em;
}

.identity { color: var(--t2); font-size: 12px; display: flex; align-items: center; gap: 8px; }

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #b163f9, var(--brand));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}

/* ----------------------------------------------------------------- buttons */

button {
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  border-radius: var(--r-btn);
  min-height: 34px;
  padding: 8px 14px;
  border: 1px solid transparent;
  font-weight: 600;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}
button:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }

button.primary { background: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(58, 29, 83, .18); }
button.primary:hover { background: var(--brand-strong); transform: translateY(-1px); }

button.ghost { background: var(--surface); border-color: rgba(58, 29, 83, .14); color: var(--t1); }
button.ghost:hover { background: var(--brand-wash); border-color: var(--brand); color: var(--brand-strong); }
button.ghost.danger { color: var(--danger); }
button.ghost.danger:hover { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }

button.small { min-height: 28px; padding: 4px 10px; font-size: 12px; border-radius: 8px; }
button.icon {
  min-height: 28px;
  width: 28px;
  padding: 0;
  border-radius: 8px;
  background: transparent;
  border: 1px solid rgba(58, 29, 83, .12);
  color: var(--t2);
}
button.icon:hover { background: var(--brand-wash); color: var(--brand); border-color: var(--brand); }
button.icon svg { width: 14px; height: 14px; }

button.block { width: 100%; }

button.link {
  background: none;
  border: 0;
  padding: 0 10px 0 0;
  min-height: auto;
  color: var(--brand);
  font-size: 12.5px;
  font-weight: 600;
  border-radius: var(--r-sm);
}
button.link:hover { color: var(--brand-strong); text-decoration: underline; }
button.link.danger { color: var(--danger); }

/* ------------------------------------------------------------- seg control */

.seg-ctrl {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: rgba(0, 0, 0, .04);
  border-radius: 10px;
  width: fit-content;
}
.seg-ctrl button {
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--t2);
  min-height: 28px;
  padding: 4px 14px;
  font-size: 12.5px;
  font-weight: 500;
}
.seg-ctrl button:hover { color: var(--t1); }
.seg-ctrl button.active { background: #fff; color: var(--t1); font-weight: 600; box-shadow: 0 1px 4px rgba(0, 0, 0, .1); }
.seg-ctrl button:disabled { opacity: 0.4; }

/* ------------------------------------------------------------------ switch */

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--t2);
  cursor: pointer;
  user-select: none;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: rgba(58, 29, 83, .18);
  position: relative;
  transition: background 160ms ease;
  flex-shrink: 0;
}
.switch .track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  transition: transform 160ms ease;
}
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }

/* ------------------------------------------------------------------- login */

.panel.centered {
  max-width: 380px;
  margin: 72px auto;
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 34px 30px;
  box-shadow: var(--shadow-sm);
}

.panel.centered h1 { font-size: 18px; margin: 0 0 4px; letter-spacing: -0.01em; text-align: center; }
.panel.centered > .muted { text-align: center; margin: 0; font-size: 12.5px; }
.panel.centered form { margin-top: 22px; }
.panel.centered .field { margin-bottom: 14px; }
.panel.centered button.block { margin-top: 6px; min-height: 38px; }

.login-mark {
  width: 46px;
  height: 46px;
  margin: 0 auto 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, #b163f9, var(--brand));
  display: grid;
  place-items: center;
  box-shadow: 0 8px 22px rgba(158, 60, 248, 0.3);
}
.login-mark svg { width: 24px; height: 24px; }

.muted { color: var(--t3); }
.t2 { color: var(--t2); }
.error { color: var(--danger); font-size: 12.5px; }

/* ------------------------------------------------------------ oauth consent */

.consent-list { list-style: none; margin: 18px 0; padding: 0; font-size: 12.5px; }
.consent-list li {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--hairline);
}
.consent-list li:last-child { border-bottom: 0; }
.consent-list .k { color: var(--t3); min-width: 72px; flex-shrink: 0; }
.consent-list .v { font-family: var(--mono); font-size: 12px; word-break: break-all; color: var(--t1); }
.consent-actions { display: flex; gap: 10px; margin-top: 6px; }
.consent-actions button { flex: 1; min-height: 38px; }
.consent-note { text-align: center; margin: 16px 0 0; font-size: 12px; }

/* --------------------------------------------------------------- workspace */

.workspace {
  display: grid;
  grid-template-columns: var(--nav-width) 1fr;
  height: calc(100vh - var(--header-height));
  overflow: hidden;
  transition: grid-template-columns 220ms ease;
}
.workspace.nav-collapsed { grid-template-columns: var(--nav-collapsed) 1fr; }

/* 白色侧栏；active 项浅紫底 + 品牌紫文字 */
.modnav {
  background: var(--surface);
  border-right: 1px solid var(--hairline);
  padding: 14px 10px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.modnav-logo { width: 96px; height: auto; margin: 4px 8px 16px; }
.nav-collapsed .modnav-logo { display: none; }

.modnav-group {
  color: var(--t3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin: 14px 10px 4px;
  text-transform: uppercase;
  white-space: nowrap;
}
.modnav-group:first-of-type { margin-top: 0; }
.nav-collapsed .modnav-group { font-size: 0; margin: 10px 8px 4px; border-top: 1px solid var(--hairline); }
.nav-collapsed .modnav-group:first-of-type { border-top: 0; margin-top: 0; }

.modnav-item {
  width: 100%;
  justify-content: flex-start;
  background: transparent;
  border: 0;
  color: var(--t2);
  padding: 0 10px;
  min-height: 34px;
  border-radius: var(--r-btn);
  font-size: 13px;
  font-weight: 500;
  gap: 10px;
}
.modnav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.modnav-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modnav-item:hover { background: rgba(158, 60, 248, .06); color: var(--t1); }
.modnav-item.active { background: rgba(158, 60, 248, .09); color: var(--brand); font-weight: 600; }
.nav-collapsed .modnav-item { justify-content: center; padding: 0; }
.nav-collapsed .modnav-item span { display: none; }

.module { min-width: 0; overflow: hidden; }
.module-split { display: grid; grid-template-columns: 320px 1fr; height: 100%; }
.module-single { overflow-y: auto; padding: 22px 26px 64px; }

.eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 2px;
}

.module-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.module-head h1 { font-size: 20px; margin: 0; letter-spacing: -0.01em; line-height: 1.3; }
.module-single > .muted { margin: 0 0 12px; font-size: 12.5px; max-width: 760px; color: var(--t2); }
.module-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.module-single .seg-ctrl { margin: 6px 0 14px; }

.meta-line {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--t3);
  margin: 0 0 14px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.meta-line .dirty-flag { font-family: var(--font); }

/* ----------------------------------------------------------------- sidebar */

.sidebar {
  border-right: 1px solid var(--hairline);
  background: var(--surface);
  padding: 14px 14px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  min-width: 0;
}

.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; }
.field > span { color: var(--t2); font-weight: 600; }
.field input, .field select, .field textarea {
  font: inherit;
  font-size: 13px;
  padding: 7px 10px;
  border: 1px solid rgba(58, 29, 83, .16);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--t1);
  width: 100%;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--ring);
}
.field textarea { resize: vertical; min-height: 84px; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; }
.field select[multiple] { font-family: var(--mono); font-size: 12.5px; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.field.inline > span { white-space: nowrap; }
.field.inline input, .field.inline select { width: auto; }
.field .hint { color: var(--t3); font-weight: 400; font-size: 11.5px; }

.count { font-size: 12px; color: var(--t3); margin: 0; font-weight: 600; }

.doc-list {
  list-style: none;
  margin: 0 -14px 0;
  padding: 8px 8px 16px;
  overflow-y: auto;
  flex: 1;
  border-top: 1px solid var(--hairline);
}
.doc-list li {
  padding: 9px 10px;
  border-radius: var(--r-btn);
  cursor: pointer;
  margin-bottom: 2px;
  border: 1px solid transparent;
  transition: background 140ms ease;
}
.doc-list li:hover { background: var(--brand-wash); }
.doc-list li.selected { background: rgba(158, 60, 248, .09); }
.doc-title { display: block; font-weight: 600; margin-bottom: 2px; line-height: 1.4; }
.doc-slug { display: block; font-size: 11px; color: var(--t3); font-family: var(--mono); word-break: break-all; }

/* ------------------------------------------------------------------ badges */

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  margin-top: 6px;
  margin-right: 4px;
  white-space: nowrap;
  line-height: 1.5;
}
.badge-live, .badge-active { color: var(--success); background: var(--success-bg); }
.badge-pending-review, .badge-brand { color: var(--brand-strong); background: var(--brand-soft); }
.badge-not-in-release-batch, .badge-off, .badge-expired, .badge-revoked { color: var(--t3); background: var(--neutral-bg); }
.badge-warn { color: var(--warn); background: var(--warn-bg); }
.badge-approval-evidence-missing,
.badge-approval-hash-mismatch,
.badge-approval-evidence-file-missing { color: var(--danger); background: var(--danger-bg); }

/* ------------------------------------------------------------------ detail */

.detail { overflow-y: auto; padding: 22px 26px 72px; min-width: 0; }
.detail > h1, .detail > .slugline, .detail > .status-card,
.detail > .action-bar, .detail > .seg-ctrl, .detail > .editor { max-width: 1000px; }

.placeholder { color: var(--t3); text-align: center; font-size: 13px; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 100%;
  min-height: 280px;
  color: var(--t3);
  text-align: center;
}
.empty-state svg { width: 40px; height: 40px; color: #ce9efc; }
.empty-state strong { font-size: 14px; color: var(--t1); }
.empty-state p { margin: 0; font-size: 12.5px; max-width: 330px; line-height: 1.7; }

.detail h1 { font-size: 19px; margin: 0 0 4px; letter-spacing: -0.01em; line-height: 1.35; }
.detail .slugline {
  font-family: var(--mono);
  color: var(--t3);
  font-size: 11.5px;
  margin: 0 0 16px;
  word-break: break-all;
}
.dirty-flag { color: var(--brand); font-weight: 600; font-family: var(--font); }

.status-card, .card, .editor, .table-wrap, .item-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
}
.card, .item-card { transition: transform var(--lift), box-shadow var(--lift); }
.card:hover, .item-card:hover { transform: translateY(-3px) scale(1.006); box-shadow: var(--shadow-hover); }

.status-card { padding: 16px 18px; margin-bottom: 14px; }
.status-card h2 { font-size: 13px; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.status-card h2 .badge { margin-top: 0; }
.status-reason { margin: 0 0 10px; font-size: 12.5px; color: var(--t2); }
.status-facts { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.status-facts li {
  display: flex;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--hairline);
}
.status-facts li:last-child { border-bottom: 0; }
.status-facts .k { color: var(--t3); min-width: 124px; flex-shrink: 0; }
.status-facts .v { font-family: var(--mono); word-break: break-all; }
.ok { color: var(--success); }
.no { color: var(--danger); }

.action-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.action-bar .muted { font-size: 12px; }
.detail > .seg-ctrl { margin-bottom: 14px; }

.editor { padding: 20px 22px; }
.editor .field { margin-bottom: 14px; }
.editor-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
}
.editor-actions .muted { font-size: 12px; }

/* ----------------------------------------------------------------- preview */

.preview-banner {
  background: var(--brand-soft);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  color: var(--brand-strong);
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  word-break: break-all;
}
.preview-frame {
  width: 100%;
  height: 70vh;
  border: 1px solid var(--line);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
  background: #fff;
  display: block;
}

/* ------------------------------------------------------------------ tables */

.table-wrap { overflow: auto; margin-top: 12px; max-height: calc(100vh - 220px); }
.data-table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12.5px; }
.data-table th, .data-table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: middle;
}
.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--t3);
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
  background: #fbf9fd;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: var(--brand-wash); }
.data-table .nowrap { white-space: nowrap; }
.data-table .mono { font-family: var(--mono); font-size: 11.5px; }
.data-table .badge { margin-top: 0; }
.data-table .muted { color: var(--t3); }

.row-actions { white-space: nowrap; }
.row-actions .muted { font-size: 12px; }

/* ------------------------------------------------------------------- cards */

.card { padding: 20px 22px; margin: 14px 0; max-width: 680px; }
.card.wide { max-width: none; }
.card h2 { font-size: 14px; margin: 0 0 10px; display: flex; align-items: baseline; gap: 8px; }
.card h2 .doc-slug { display: inline; font-size: 11px; }
.card .field { margin-bottom: 12px; }
.card form button { margin-top: 4px; }
.card > p { margin: 0 0 10px; font-size: 12.5px; color: var(--t2); }

.scope-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.scope-list li {
  font-size: 11.5px;
  font-family: var(--mono);
  padding: 3px 8px;
  border-radius: var(--r-sm);
  background: var(--brand-wash);
  color: var(--brand-strong);
}

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.card-grid .card { margin: 0; max-width: none; }

/* ---------------------------------------------------------- config editors */

.item-list { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; max-width: 1000px; }
.item-card { padding: 12px 14px; display: flex; gap: 14px; align-items: center; }
.item-card:hover { transform: translateY(-2px) scale(1.003); }
.item-thumb {
  width: 64px;
  height: 64px;
  border-radius: var(--r-lg);
  background: var(--brand-wash);
  flex-shrink: 0;
  object-fit: cover;
  display: grid;
  place-items: center;
  color: #ce9efc;
  overflow: hidden;
}
.item-thumb.small { width: 48px; height: 48px; border-radius: 50%; }
.item-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item-thumb svg { width: 24px; height: 24px; }
.item-main { flex: 1; min-width: 0; }
.item-title { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.item-title .badge { margin: 0; }
.item-sub { color: var(--t3); font-size: 11.5px; font-family: var(--mono); word-break: break-all; margin-top: 2px; }
.item-desc { color: var(--t2); font-size: 12px; margin-top: 4px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.item-index { font-family: var(--mono); font-size: 11px; color: var(--t3); min-width: 20px; text-align: right; }
.item-controls { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.item-controls .switch { margin-right: 6px; }

.group-card { padding: 0; display: block; }
.group-head { display: flex; gap: 12px; align-items: center; padding: 12px 14px; }
.group-body { border-top: 1px solid var(--hairline); padding: 8px 14px 12px 14px; }
.faq-rows { gap: 0; }
.faq-rows > li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid var(--hairline);
}
.faq-rows > li:last-child { border-bottom: 0; }
.faq-rows > li.muted { padding: 14px 0; }
.faq-rows .item-index { padding-top: 2px; }
.faq-rows.standalone {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
  padding: 6px 14px;
}
.faq-q { font-weight: 600; font-size: 12.5px; }
.faq-a { color: var(--t2); font-size: 12px; margin-top: 2px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.group-add { margin-top: 8px; }

.config-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.config-toolbar .grow { flex: 1; }
.config-toolbar select { max-width: 320px; }

.inline-note {
  border-radius: var(--r-md);
  padding: 8px 12px;
  margin: 0 0 12px;
  font-size: 12.5px;
  background: var(--brand-wash);
  color: var(--brand-strong);
  max-width: 1000px;
}
.inline-note.warn { background: var(--warn-bg); color: var(--warn); }
.inline-note.danger { background: var(--danger-bg); color: var(--danger); }
.inline-note button { margin-left: 10px; }

/* ----------------------------------------------------------------- mcp page */

.code-block {
  position: relative;
  background: #2a1a3a;
  color: #f4ecff;
  border-radius: var(--r-lg);
  padding: 12px 44px 12px 14px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 8px 0 12px;
}
.code-block .copy {
  position: absolute;
  top: 8px;
  right: 8px;
  min-height: 24px;
  padding: 2px 8px;
  font-size: 11px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border: 0;
}
.code-block .copy:hover { background: rgba(255, 255, 255, .24); }
.mcp-address { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mcp-address code {
  background: var(--brand-wash);
  color: var(--brand-strong);
  padding: 4px 10px;
  border-radius: var(--r-md);
  font-size: 12.5px;
  word-break: break-all;
}
.step-list { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--t2); }
.step-list li { margin-bottom: 4px; }

/* ------------------------------------------------------------------ modals */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(36, 22, 46, .45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  padding: 24px;
}
.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 22px 24px;
  width: min(760px, 100%);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-pop);
}
.modal h2 { font-size: 16px; margin: 0 0 6px; letter-spacing: -0.01em; }
.modal > .muted { margin: 0; font-size: 12.5px; color: var(--t2); }
.modal-body { overflow-y: auto; margin: 16px 0; }
.modal-body .field { margin-bottom: 12px; }
.modal-body .field:last-child { margin-bottom: 0; }
.modal-body .muted { margin: 0 0 10px; font-size: 12.5px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

.inline-warn {
  color: var(--danger);
  background: var(--danger-bg);
  border-radius: var(--r-md);
  padding: 10px 12px;
  margin: 0 0 12px;
  font-size: 12.5px;
  word-break: break-all;
}
.inline-warn.secret { font-family: var(--mono); font-size: 12.5px; user-select: all; }

/* -------------------------------------------------------------------- diff */

.diff-paths {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 96px;
  overflow: auto;
  /* The modal is a column flexbox and .diff takes flex:1; without this the
     chip row is squeezed to a single scrolling line and paths get hidden. */
  flex-shrink: 0;
}
.diff-paths li {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--brand-wash);
  color: var(--brand-strong);
  padding: 2px 8px;
  border-radius: var(--r-sm);
}
.diff-paths li.more { background: var(--neutral-bg); color: var(--t3); }

.diff {
  flex: 1;
  overflow: auto;
  margin: 12px 0;
  border-radius: var(--r-lg);
  background: #fbf9fd;
  border: 1px solid var(--hairline);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  padding: 6px 0;
  min-height: 80px;
}
.diff div { padding: 0 14px; white-space: pre-wrap; word-break: break-all; }
.diff .add { background: var(--success-bg); color: var(--success); }
.diff .del { background: var(--danger-bg); color: var(--danger); }
.diff .same { color: var(--t3); }
.diff .none { padding: 20px; color: var(--t3); text-align: center; }

/* ------------------------------------------------------------------- toast */

.toast {
  position: fixed;
  top: 64px;
  right: 16px;
  background: #2a1a3a;
  color: #fff;
  padding: 9px 14px;
  border-radius: var(--r-md);
  z-index: 30;
  max-width: min(420px, 80vw);
  font-size: 12px;
  font-weight: 500;
  box-shadow: var(--shadow-pop);
  animation: toast-in 220ms ease;
}
.toast.bad { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------- narrow view */

@media (max-width: 1100px) {
  .module-split { grid-template-columns: 280px 1fr; }
}

/* Chrome autofill paints its own background; keep it inside the theme. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--t1);
  -webkit-box-shadow: 0 0 0 1000px var(--surface) inset;
  caret-color: var(--t1);
}

/* Declarative task pages share the console's color, radius and type tokens. */
.ps-page { max-width: 1280px; margin: 0 auto; display: grid; gap: 16px; min-width: 0; }
.ps-page h1 { font-size: 24px; margin: 8px 0; }
.ps-page h2 { font-size: 16px; margin: 0 0 12px; }
.ps-fixed { padding: 8px 0; }
.ps-fixed-grid, .ps-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ps-fixed-grid > *, .ps-block, .ps-viewer { min-width: 0; }
.ps-page p, .ps-page a, .ps-page dd, .ps-page th, .ps-page td { overflow-wrap: anywhere; }
.ps-page summary { cursor: pointer; font-weight: 600; }
.ps-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.ps-item:last-child { border-bottom: 0; }
.ps-phase progress { display: block; width: 100%; margin: 8px 0; accent-color: var(--brand); }
.ps-phase span, .ps-timeline time { color: var(--t2); }
.ps-page textarea, .ps-page [data-ps-annotation] input { display: block; width: 100%; margin: 6px 0 12px; }
.ps-page form { margin: 12px 0; }
.ps-page video, .ps-image { display: block; width: 100%; max-height: 520px; object-fit: contain; background: var(--neutral-bg); border-radius: var(--r-md); }
.ps-image { cursor: crosshair; }
.ps-scroll { overflow: auto; max-width: 100%; }
.ps-diff { padding: 16px; overflow: auto; background: var(--neutral-bg); font-family: var(--mono); }
.ps-empty, .ps-warnings { color: var(--t3); }
.ps-legacy { margin-top: 16px; }
.ps-page .detail-grid { grid-template-columns: minmax(0, 1fr); }
.ps-page .side-panel { position: static; width: 100%; max-width: 100%; max-height: none; }
.ps-page .ps-operations > [data-ps-controls-slot] { overflow-x: auto; }
.ps-page .detail-actions { flex-wrap: wrap; }
.ps-page [data-ps-controls-slot] .detail-center { min-width: 0; }
.ps-page .ps-operations .detail-head h1 { font-size: 18px; }
@media (max-width: 760px) {
  .ps-fixed-grid, .ps-gallery { grid-template-columns: minmax(0, 1fr); }
  .ps-page { gap: 12px; }
  .ps-page .card-pad { padding: 14px; }
  .ps-page .tabs { overflow-x: auto; }
  .ps-page .stepper { overflow-x: auto; }
  .ps-page .cmd-box .row { flex-wrap: wrap; min-width: 0; }
  .ps-page .vd-cols { grid-template-columns: minmax(0, 1fr); }
  /* Wrapped labels must grow beyond the shared fixed control height. */
  .ps-page .btn { height: auto; min-height: var(--ctl-h); padding-block: 6px; }
  .ps-page .btn.sm { min-height: var(--ctl-h-sm); padding-block: 4px; }
}

.ps-evidence { width: 96px; max-height: 96px; object-fit: contain; border-radius: var(--r-sm); }
.ps-page .stage-bar-main { min-width: 0; flex-basis: 100%; overflow-wrap: anywhere; }
.ps-page .stage-bar { width: 100%; padding: 12px; }
.ps-page .btn { max-width: 100%; white-space: normal; }
.ps-page .dr-head > *, .ps-page .dr-head .row, .ps-page .stage-bar-actions { min-width: 0; max-width: 100%; }
.ps-page .dr-pop { max-width: calc(100vw - 32px); }

.ps-steps { display: flex; flex-wrap: wrap; gap: 8px 24px; padding-left: 24px; color: var(--t3); }
.ps-steps .done { color: var(--brand); }
