/* ApCms 管理后台样式（无构建依赖，纯 CSS） */
:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  /* 次级面板：表头 / 行 hover 等比卡片底略深一层的面 */
  --panel-2: #fafbfd;
  /* 文本输入类控件底色：比卡片更深一层，聚焦边界更清楚 */
  --field: #f6f8fb;
  --ink: #1f2937;
  --ink-2: #4b5563;
  --ink-3: #8a93a3;
  --line: #e5e8ef;
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --brand-soft: #eef0ff;
  --ok: #15803d;
  --ok-soft: #e8f7ee;
  --warn: #b45309;
  --warn-soft: #fdf3e2;
  --danger: #b91c1c;
  --danger-soft: #fdecec;
  /* 侧栏比内容区底色（#f4f6fa）深一档，仍能和白色二级面板区分开。
     三档要保持「底 < hover < 分隔线」的深浅顺序，调一个就三个一起调，
     否则 hover 会和底色糊在一起、边界线反而比底色还浅。 */
  --sidebar: #e2e8f1;
  --sidebar-2: #d6dfea;
  /* 侧栏文字与分隔线：浅底/深底两套，随 body.dark 切换 */
  --sidebar-ink: #47536a;
  --sidebar-line: #cfd7e3;
  --hover: #f1f5f9;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- 布局 */
.ap-shell { display: flex; min-height: 100vh; }

.ap-sidebar {
  width: 76px;
  flex: 0 0 76px;
  background: var(--sidebar);
  /* 切换主题色时侧栏同步带一层极淡的品牌色（不压深底色） */
  background-image: linear-gradient(var(--sidebar-tint, transparent), var(--sidebar-tint, transparent));
  color: var(--sidebar-ink);
  /* 浅底时靠这条边界线与右侧二级面板区开 */
  border-right: 1px solid var(--sidebar-line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  /* 压在二级菜单抽屉之上（抽屉是 46）：窄屏抽屉从左滑入时是从主菜单「后面」拉出来，
     而不是从它上面飞过去。两者展开后并不重叠，只在滑动过程中会经过这一列。 */
  z-index: 50;
  transition: width .18s ease, flex-basis .18s ease;
}

.ap-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 0 12px;
  border-bottom: 1px solid var(--sidebar-line);
}

.ap-brand-logo { width: 28px; height: 28px; object-fit: contain; border-radius: 6px; }

.ap-brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, #6366f1, #4338ca);
  color: #fff; font-weight: 700; font-size: 15px; flex: 0 0 auto;
}
.ap-brand-mark-lg { width: 44px; height: 44px; border-radius: 12px; font-size: 22px; }

/* 窄栏放不下站名，只留 logo */
.ap-brand-text { display: none; }

.ap-nav { padding: 10px 8px; flex: 1 1 auto; display: flex; flex-direction: column; gap: 4px; }

/* 左侧一级项：图标在上、文字在下（迅睿式） */
.ap-nav1 {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 2px 8px;
  border-radius: 10px;
  color: var(--sidebar-ink);
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}
.ap-nav1:hover { background: var(--sidebar-2); color: var(--ink); text-decoration: none; }
.ap-nav1.active { background: var(--brand); color: #fff; }
.ap-nav1 .ap-ico { font-size: 17px; height: 20px; display: flex; align-items: center; justify-content: center; }
.ap-nav1-text { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

.ap-nav-group {
  padding: 14px 10px 6px;
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--sidebar-ink);
  opacity: .75;                 /* 次要标题：比正文淡，但浅底深底都还看得清 */
  text-transform: uppercase;
}

.ap-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  margin-bottom: 2px;
  border-radius: 8px;
  color: var(--sidebar-ink);
  font-size: 13.5px;
  white-space: nowrap;
}
.ap-nav-item:hover { background: var(--sidebar-2); color: var(--ink); text-decoration: none; }
.ap-nav-item.active { background: var(--brand); color: #fff; }
.ap-nav-item .ap-ico { width: 20px; text-align: center; opacity: .9; font-size: 14px; }
.ap-nav-item .ap-ico i { width: 1.15em; text-align: center; display: inline-block; }

.ap-sidebar-foot {
  padding: 10px 4px;
  font-size: 10px;
  color: var(--ink-3);
  text-align: center;
  border-top: 1px solid var(--sidebar-line);
  white-space: nowrap;
  overflow: hidden;
}

.ap-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.ap-topbar {
  height: 58px;
  flex: 0 0 58px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 0 18px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.ap-crumb { font-weight: 600; font-size: 15px; flex: 0 0 auto; margin-right: 16px; }
.ap-topbar-right { display: flex; align-items: center; gap: 6px; }

.ap-body { display: flex; align-items: stretch; flex: 1 1 auto; min-width: 0; }

/* 迅睿式右侧二三级菜单面板 */
.ap-subnav {
  width: 159px;
  flex: 0 0 159px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  /* 高度不溢出：顶栏吸顶 58px，面板最高到视口底部，超出则内部滚动 */
  position: sticky;
  top: 58px;
  max-height: calc(100vh - 58px);
  overflow-y: auto;
  padding-bottom: 24px;
}
.ap-sub-title {
  padding: 14px 16px 11px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}
.ap-sub-group { margin: 2px 8px 4px; }
.ap-sub-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 8px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}
.ap-sub-group-head:hover { background: var(--hover); }
.ap-sub-group-head .ap-caret { font-size: 10px; color: #94a3b8; }
.ap-sub-list { padding: 2px 0 5px; }
.ap-sub-plain { padding: 4px 8px; }
.ap-sub-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px 6px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--ink-2);
}
.ap-sub-item:hover { background: var(--hover); color: var(--brand); text-decoration: none; }
.ap-sub-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.ap-sub-item .ap-dot { width: 5px; height: 5px; border-radius: 50%; background: #cbd5e1; flex: 0 0 auto; }
.ap-sub-item.active .ap-dot { background: var(--brand); }

.ap-content { padding: 20px; width: 100%; min-width: 0; }

@media (max-width: 900px) {
  .ap-body { flex-direction: column; }
  /* 窄屏下二级菜单改为抽屉浮层：不再整块压在内容上方，点链接或点空白自动收起。
     左栏是主菜单入口，抽屉贴在它右侧（left = .ap-sidebar 的 76px），不能盖住。 */
  .ap-subnav {
    position: fixed;
    top: 58px;
    left: 76px;
    bottom: 0;
    width: 120px;
    flex: 0 0 auto;
    max-height: none;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .20);
    z-index: 46;
    /* 收起必须移到视口外：left 是 76px，只移 -100% 会停在 -44px，仍然压住左栏主菜单。
       多移一个左栏宽度，收起时右边缘刚好落在 0，不遮任何东西。 */
    transform: translateX(calc(-100% - 76px));
    /* left 也过渡：折叠左栏时抽屉跟着一起走，与 .ap-sidebar 的 width .18s 同步 */
    transition: transform .22s ease, left .18s ease;
  }
  body.ap-subnav-open .ap-subnav { transform: none; }
  /* 120px 放不下长菜单名时截断，不让它撑开或折行 */
  .ap-subnav .ap-sub-item,
  .ap-subnav .ap-sub-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* 半透明遮罩（纯视觉；伪元素不接收点击，关闭逻辑在 JS 里按「点到抽屉外」判断）
     同样从左栏右侧起，主菜单始终可见可点 */
  body.ap-subnav-open::before {
    content: '';
    position: fixed;
    top: 58px;
    right: 0;
    bottom: 0;
    left: 76px;
    background: rgba(15, 23, 42, .28);
    z-index: 45;
  }
}

body.ap-sidebar-collapsed .ap-sidebar { width: 52px; flex-basis: 52px; }
body.ap-sidebar-collapsed .ap-nav1-text,
body.ap-sidebar-collapsed .ap-sidebar-foot { visibility: hidden; }
body.ap-sidebar-collapsed .ap-nav1 { padding-left: 0; padding-right: 0; }
/* 折叠时左侧只留图标，右侧二三级面板一并收起（JS 仍按路由控制 hidden，这里只做视觉收起） */
body.ap-sidebar-collapsed .ap-subnav { display: none; }

/* 窄屏补规则 —— 必须放在上面 .ap-sidebar-collapsed 之后：同权重靠先后决定胜负。
   折叠在窄屏同样生效（76px → 52px，宽度真的变），只是抽屉不跟着被隐藏，
   并且要贴到折叠后的宽度，否则会留出一条缝。 */
@media (max-width: 900px) {
  body.ap-sidebar-collapsed .ap-subnav {
    display: block;
    left: 52px;
    /* 收起位移跟着 left 走：折叠后左栏 52px，多移 76px 会飞出视口太多、动画看着不跟手 */
    transform: translateX(calc(-100% - 52px));
  }
  body.ap-sidebar-collapsed.ap-subnav-open::before { left: 52px; }
  /* 展开态写在最后：与上面同权重，靠顺序保证 transform: none 胜出 */
  body.ap-subnav-open .ap-subnav,
  body.ap-sidebar-collapsed.ap-subnav-open .ap-subnav { transform: none; }
}

/* 桌面折叠态：上面的 display:none 会让折叠后彻底点不出二级菜单。
   但折叠本来是为了省出横向空间，常驻一个 159px 面板就白折了 —— 所以改成浮层：
   点一级菜单才滑出，点链接 / 点空白收起。必须放在 display:none 那条之后才盖得住。 */
@media (min-width: 901px) {
  body.ap-sidebar-collapsed .ap-subnav {
    display: block;
    position: fixed;
    top: 58px;
    left: 52px;
    bottom: 0;
    width: 159px;
    flex: 0 0 auto;
    max-height: none;
    border-right: 1px solid var(--line);
    box-shadow: 0 12px 32px rgba(15, 23, 42, .20);
    z-index: 46;                 /* 低于 .ap-sidebar 的 50：从主菜单后面滑出 */
    transform: translateX(calc(-100% - 52px));
    transition: transform .22s ease, left .18s ease;
  }
  body.ap-sidebar-collapsed.ap-subnav-open .ap-subnav { transform: none; }
}

/* ---------------------------------------------------------------- 通用组件 */
.ap-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
/*
.ap-card + .ap-card { margin-top: 16px; }
*/
.ap-card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.ap-card-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.ap-card-head .ap-spacer { flex: 1 1 auto; }
.ap-card-head > span:first-child { font-size: 15px; font-weight: 600; color: var(--ink); }
/* 配置项手风琴（模块配置抽屉）：点标题收缩/展开。收起只是隐藏，表单值照常提交 */
.ap-acc-head { cursor: pointer; user-select: none; }
.ap-acc-head:hover h2 { color: var(--brand); }
.ap-acc-head:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--brand-soft); }
.ap-acc-arrow {
  flex: 0 0 auto; width: 7px; height: 7px; margin-bottom: 3px;
  border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3);
  transform: rotate(45deg); /* 收起：朝下 */
  transition: transform .18s ease;
}
.ap-acc-head.is-open .ap-acc-arrow { transform: rotate(-135deg); } /* 展开：朝上 */
.ap-card-body { padding: 16px; }
.ap-card-body.ap-tight { padding: 0; }
.ap-card-body[hidden] { display: none; }

.ap-page-head { display: flex; align-items: center; gap: 12px; margin-bottom:12px; flex-wrap: wrap; }
/* 说明文字块可收缩：文案偏长时先挤文字，别把右侧按钮顶到第二行 */
.ap-page-head > div { min-width: 0; }
.ap-page-head h1 { margin: 0; font-size: 19px; font-weight: 650; }
.ap-page-head p { margin: 2px 0 0; color: var(--ink-3); font-size: 13px; }
.ap-page-head .ap-spacer { flex: 1 1 auto; }

.ap-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px;
  border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink);
  font-size: 13.5px; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.ap-btn:hover { border-color: var(--ink-3); background: var(--panel-2); text-decoration: none; }
.ap-btn:disabled { opacity: .55; cursor: not-allowed; }
.ap-btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.ap-btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.ap-btn-danger { color: var(--danger); border-color: #f3c9c9; background: var(--panel); }
.ap-btn-danger:hover { background: var(--danger-soft); border-color: #eab3b3; }
/* 危险按钮的浅红描边只适合浅色：深色下压暗，不然在暗底上发白 */
body.dark .ap-btn-danger { border-color: #5c2b2b; }
body.dark .ap-btn-danger:hover { border-color: #7d3c3c; }
.ap-btn-ghost { background: transparent; }
.ap-btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.ap-btn-block { width: 100%; height: 40px; font-size: 14.5px; }

.ap-icon-btn {
  width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid transparent; background: transparent;
  color: var(--ink-2); cursor: pointer; font-size: 15px;
}
.ap-icon-btn:hover { background: var(--hover); }
.ap-icon-btn.is-active { background: var(--brand-soft); color: var(--brand); }

/* 顶栏：全局搜索 / 主题色 / 深色 / 全屏 / 用户区 */
.ap-topbar-search {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  flex: 0 1 320px; max-width: 360px;
  margin-right: auto;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 9px; padding: 0 12px; height: 36px;
}
.ap-topbar-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.ap-topbar-search i { color: var(--ink-3); font-size: 13px; }
.ap-topbar-search input { border: 0; background: transparent; outline: none; flex: 1 1 auto; font-size: 13.5px; color: var(--ink); min-width: 0; }
.ap-search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); padding: 6px; max-height: 320px; overflow-y: auto;
}
.ap-search-results .ap-sr-group { padding: 4px 10px; font-size: 11px; color: var(--ink-3); }
.ap-search-results a { display: block; padding: 8px 10px; border-radius: 7px; color: var(--ink); font-size: 13px; }
.ap-search-results a:hover { background: var(--brand-soft); color: var(--brand); text-decoration: none; }
.ap-search-results .ap-sr-empty { padding: 10px; color: var(--ink-3); font-size: 13px; text-align: center; }

.ap-theme-pop, .ap-user { position: relative; }
.ap-theme-panel {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 50;
  width: 190px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); padding: 12px;
}
.ap-theme-swatches { display: flex; gap: 10px; justify-content: space-between; margin-bottom: 10px; }
.ap-swatch { width: 22px; height: 22px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: transform .12s; }
.ap-swatch:hover { transform: scale(1.12); }
.ap-swatch.is-active { border-color: var(--ink); }
.ap-theme-row { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 10px; }
.ap-theme-toggle { display: inline-flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--line); color: var(--ink-2); border-radius: 8px; font-size: 12.5px; padding: 5px 10px; cursor: pointer; }
.ap-theme-toggle:hover { color: var(--brand); border-color: var(--brand); }

.ap-user { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 9px; cursor: pointer; }
.ap-user:hover { background: var(--hover); }
.ap-user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; flex: 0 0 auto; }
.ap-user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.ap-user-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.ap-user-role { font-size: 11px; color: var(--ink-3); }
.ap-user-menu { position: absolute; top: calc(100% + 10px); right: 0; z-index: 50; min-width: 150px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; }
.ap-user-item { display: block; width: 100%; text-align: left; background: transparent; border: 0; padding: 9px 10px; border-radius: 7px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.ap-user-item:hover { background: var(--brand-soft); color: var(--brand); }

body.dark .ap-sidebar-foot { color: #7b8798; }
body.dark .ap-sub-item .ap-dot { background: #4b5563; }

/* 深色模式 */
body.dark {
  --bg: #0f1115;
  --panel: #161a21;
  --panel-2: #1b212b;
  --field: #10151c;
  --ink: #e6e9ef;
  --ink-2: #aab1bd;
  --ink-3: #6b7280;
  --line: #232a34;
  --sidebar: #1a2029;
  --sidebar-2: #232b37;
  --sidebar-ink: #cbd5e1;
  --sidebar-line: #232a34;
  --hover: #20262f;
  --ok-soft: #14251a;
  --warn-soft: #2a2012;
  --danger-soft: #2a1414;
}

@media (max-width: 720px) {
  .ap-topbar-search { display: none; }
}

/* 深色/浅色切换的圆形揭示动画遮罩（从鼠标点击处放大/缩小覆盖全屏） */
#theme-fx {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background: transparent;
  clip-path: circle(0px at 50% 50%);
  will-change: clip-path;
}

/*
 * 主题切换期间的配色渐变：只在切换那 ~650ms 内挂 .ap-theme-anim。
 *
 * 必须和圆形揭示同时开始：原来等圆形铺满、遮罩实化之后才切配色，于是撤掉遮罩的
 * 那一刻颜色整体「啪」地跳过去。现在圆形一边扩散、页面一边渐变，圆形铺满时配色
 * 早已到位，遮罩淡出就没有可见的跳变。
 *
 * 用 !important 是为了盖掉组件自带的 hover transition（否则切换期间交互手感会变慢）；
 * 切换结束类就摘掉，不影响平时。
 */
/* 时长由 JS 写进 --fx-color（= 圆形时长的 80%）：配色要比圆形晚一点到位，
   否则会看到「圆还没铺满，页面颜色已经整个变过来了」 */
html.ap-theme-anim,
html.ap-theme-anim *,
html.ap-theme-anim *::before,
html.ap-theme-anim *::after {
  transition: background-color var(--fx-color, .72s) ease, color var(--fx-color, .72s) ease,
              border-color var(--fx-color, .72s) ease, box-shadow var(--fx-color, .72s) ease,
              fill var(--fx-color, .72s) ease, stroke var(--fx-color, .72s) ease !important;
}
/* 遮罩：切换一开始挂 .is-fading，透明度就跟着配色一起收敛到 0。
   若是等圆形铺满才淡出，撤遮罩那一下就是一次可见的跳变。
   时长由 JS 写进 --fx-fade：深色方向对齐配色过渡，浅色方向对齐圆形收缩。 */
html.ap-theme-anim #theme-fx { transition: none !important; }
html.ap-theme-anim #theme-fx.is-fading {
  transition: background-color var(--fx-fade, .65s) linear !important;
}

.ap-field { display: block; margin-bottom: 14px; }
.ap-field > span { display: block; margin-bottom: 6px; font-size: 12.5px; color: var(--ink-2); }
.ap-field > span .ap-req { color: var(--danger); margin-left: 2px; }
.ap-field .ap-hint { display: block; margin-top: 5px; color: var(--ink-3); font-size: 12px; }

/* 设置项（系统设置页 / 模块配置抽屉）：项间虚线分隔，标题行「名称 + key 小标」 */
.ap-field.ap-setting-item { margin-bottom: 0; padding: 13px 0; border-top: 1px dashed var(--line); }
.ap-field.ap-setting-item:first-child { border-top: 0; padding-top: 0; }
.ap-field.ap-setting-item:last-child { padding-bottom: 0; }
.ap-field > .ap-setting-head {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  margin-bottom: 7px; font-size: 13px; color: var(--ink);
}
.ap-setting-head b { font-weight: 600; }
.ap-key {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px; line-height: 1.5; color: var(--ink-3);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px;
}

/* 大屏：一个配置项占满一行 —— 「标签 | 控件」两列，说明一律跟在控件下方逐行排。
   不能做成三列（标签/控件/说明）：说明是多条（radio 的选项释义 + 整项 tip），
   按列自动布局会把第 4 个以后的元素挤回下一行第 1 列，压在标签列里，看着像跑位。
   两列时所有说明都落在第 2 列，天然就是「radio-row 的下一行」。
   必须限定 .ap-tab-panel：模块配置抽屉只有 480px 宽，两列会挤爆
   （媒体查询按视口判断，不能只写 .ap-setting-item）。 */
@media (min-width: 1081px) {
  .ap-tab-panel .ap-field.ap-setting-item {
    display: grid;
    /* 第三列只为说明留出宽度（控件仍限 650px），这样短 tip 不会被迫折行 */
    grid-template-columns: 190px minmax(0, 650px) minmax(0, 1fr);
    /* row-gap 给 3px：说明与控件之间就这一道缝，再加大字行高的天然空隙正好贴合 */
    column-gap: 20px; row-gap: 3px; align-items: start;
    position: relative;   /* 给下面 absolute 的标签当定位基准 */
  }
  /* 标签第 1 列改用绝对定位、彻底脱离网格流：
     长名称 + key 小标折成两行时，如果它占着网格轨道，就会把「输入框所在行」撑高，
     输入框底部到行底的空白正好垫在 tip 上面；之前试过 span 99 跨行，又会让
     网格真建出 99 行、行距叠加成一大块空白。绝对定位两头都不占。 */
  .ap-tab-panel .ap-field.ap-setting-item > .ap-setting-head {
    position: absolute;
    top: 13px;            /* 与项自身的 padding 13px 对齐（改成 padding 时要同步） */
    left: 0; width: 190px; /* 与第 1 列同宽 */
    padding-top: 7px; margin-bottom: 0;
    justify-content: flex-end; text-align: right;
  }
  /* 控件占第 2 列；说明从第 2 列起、一直跨到最右，用足剩余宽度：
     短 tip（几十字）才能稳在一行内，不会被 650px 的控件列宽折断。
     长释义放不下时仍会正常折行，不会溢出。 */
  .ap-tab-panel .ap-field.ap-setting-item > :not(.ap-setting-head):not(.ap-hint) { grid-column: 2; }
  .ap-tab-panel .ap-field.ap-setting-item > .ap-hint {
    grid-column: 2 / -1; margin-top: 0; max-width: none;
  }
}

/*
 * 文本类控件统一外观：不写 type 的 input 也按文本处理（[type="text"] 匹配不到它们）。
 * 用 :where() 把一串 :not() 的特异性归零——原来的 0,7,1 会压过组件自己的覆盖
 * （比如顶栏搜索框的 background:transparent 被盖成白底，深色模式下尤其扎眼）。
 * 背景走 --field：输入框比卡片底再深一层，深浅两套都有值。
 */
input:where(:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="color"])),
select,
textarea {
  width: 100%;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 1; }
textarea { min-height: 96px; resize: vertical; line-height: 1.7; }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--brand); }
input[type="radio"] { width: 15px; height: 15px; accent-color: var(--brand); }

/* 单选组（核心配置：CSRF 三态 / 自动任务权限三态） */
/* 单选做成「分段按钮」：圆点隐藏，选中态由 <i> 承担（仍是原生 radio，取值逻辑不变） */
.ap-radio-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 2px 0; }
.ap-radio { display: inline-flex; align-items: center; font-size: 13px; color: var(--ink); cursor: pointer; }
.ap-radio input[type="radio"] {
  position: absolute; width: 0; height: 0; opacity: 0; margin: 0; pointer-events: none;
}
.ap-radio i {
  font-style: normal; padding: 6px 13px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel);
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.ap-radio:hover i { border-color: var(--ink-3); background: var(--panel-2); }
.ap-radio input:checked + i {
  border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 600;
}
.ap-radio input:focus-visible + i { box-shadow: 0 0 0 3px var(--brand-soft); }

/* 密钥行：圆点输入框 + 重新生成按钮保持一行 */
.ap-secret-row { display: flex; gap: 10px; align-items: center; flex-wrap: nowrap; }
.ap-secret-row input { flex: 1 1 auto; min-width: 0; letter-spacing: 2px; }
.ap-secret-row .ap-btn { flex: 0 0 auto; white-space: nowrap; }

.ap-grid { display: grid; gap: 14px; }
.ap-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ap-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ap-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 960px) {
  .ap-grid-2, .ap-grid-3, .ap-grid-4 { grid-template-columns: 1fr; }
}

.ap-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.ap-toolbar .ap-spacer { flex: 1 1 auto; }
.ap-toolbar input[type="search"], .ap-toolbar select { width: auto; min-width: 140px; }
.ap-toolbar input{ width: inherit!important;}

/* ---------------------------------------------------------------- 表格 */
.ap-table-wrap { overflow-x: auto; }
table.ap-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ap-table th, .ap-table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ap-table th { background: var(--panel-2); color: var(--ink-2); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.ap-table tbody tr:hover { background: var(--panel-2); }
.ap-table td.ap-actions { white-space: nowrap; text-align: right; }

/* ---- 操作列（全站统一）：前 2 个按钮常驻 + 「更多 ▾」气泡收起其余 ----
   ⚠ 菜单用 fixed 定位（见 app.js 的 openOps）：挂在 <td> 里会被表格容器的
      overflow 裁掉半截，表现是「点了更多没反应」。 */
.ap-ops { display: flex; align-items: center; gap: 6px; }
.ap-ops-menu {
  position: fixed; z-index: 60; min-width: 104px; padding: 6px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .14);
  display: flex; flex-direction: column; gap: 2px;
}
.ap-ops-menu[hidden] { display: none; }
/* 弹窗（z-index:1210）内的「更多」气泡必须盖过弹窗本身，否则被遮看不到 */
.ap-modal-root .ap-ops-menu { z-index: 1300; }
.ap-ops-item {
  padding: 7px 10px; border: 0; border-radius: 7px; background: transparent;
  font-size: 12.5px; color: var(--ink-2); text-align: left; white-space: nowrap; cursor: pointer;
}
.ap-ops-item:hover { background: var(--panel-2); color: var(--ink); }
.ap-ops-item.danger { color: var(--danger, #e5484d); }
.ap-ops-item.danger:hover { background: rgba(229, 72, 77, .1); }
.ap-table .ap-cell-sub { color: var(--ink-3); font-size: 12px; }
.ap-empty { padding: 40px 16px; text-align: center; color: var(--ink-3); }

.ap-badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px;min-width: 40px;
  border-radius: 999px; font-size: 12px; background: var(--panel-2); color: var(--ink-2);
}
.ap-badge-ok { background: var(--ok-soft); color: var(--ok); }
.ap-badge-warn { background: var(--warn-soft); color: var(--warn); }
.ap-badge-brand { background: var(--brand-soft); color: var(--brand); }
/* 危险态：与 ok / warn / brand 同族调色板（安全类页面的「危险」「登录失败」用） */
.ap-badge-danger { background: var(--danger-soft); color: var(--danger); }
/* 私有态：官方独有应用（应用市场/在线升级的服务端），虚线描边表示「非分发件」 */
.ap-badge-private { background: transparent; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }
.ap-badge-private::before { content: '◆'; margin-right: 4px; font-size: 9px; color: var(--ink-3); }

.ap-pager { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.ap-pager .ap-spacer { flex: 1 1 auto; }
.ap-pager-info { color: var(--ink-3); font-size: 12.5px; }

/* ---------------------------------------------------------------- 统计卡 */
.ap-stat {
  position: relative; /* 图标绝对定位在右上角 */
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.ap-stat .ap-stat-label { color: var(--ink-3); font-size: 12.5px; }
.ap-stat .ap-stat-value { font-size: 26px; font-weight: 700; margin-top: 4px; letter-spacing: -.01em; }
.ap-stat .ap-stat-foot { color: var(--ink-3); font-size: 12px; margin-top: 2px; }
/* 右上角装饰图标：平时淡淡地摆在角落，悬停点亮并轻轻上浮 */
.ap-stat .ap-stat-icon {
  position: absolute; top: 16px; right: 16px; font-size: 20px;
  color: var(--brand); opacity: .16;
  transition: transform .25s ease, opacity .25s ease;
}
.ap-stat:hover .ap-stat-icon { opacity: .85; transform: translateY(-2px) scale(1.18); }
/* 仪表盘专属：悬停整卡微微抬起，图标动效才有「被摸到」的反馈 */
.ap-dash-stats .ap-stat { transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.ap-dash-stats .ap-stat:hover {
  transform: translateY(-3px);
  border-color: var(--brand);
  box-shadow: 0 10px 24px rgba(15, 23, 42, .10);
}

/* ---------------------------------------------------------------- 弹层 */
/* 层级必须高于全屏编辑器（1200，见 .ap-rte.is-fullscreen）：
   否则全屏下点「从附件库选择」打开的弹窗会被编辑器盖住，只有退出全屏才看得见 */
.ap-modal-root {
  position: fixed; inset: 0; z-index: 1210;
  background: rgba(15, 23, 42, .45);backdrop-filter: blur(5px);-webkit-backdrop-filter: blur(5px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 8vh 16px 16px;
  overflow-y: auto;
}
.ap-modal-root[hidden] { display: none; }
.ap-modal {
  background: var(--panel); border-radius: 12px; width: 100%; max-width: 560px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .28);
  animation: ap-pop .16s ease-out;
}
.ap-modal.ap-modal-lg { max-width: 780px; }
/* 深色下弹窗浮不出来：面板（#161a21）和遮罩是同色系，投影 rgba(15,23,42,.28) 在暗底上
   几乎不可见，只剩一团糊在一起的深色。补一圈描边把边界画出来，投影也换成纯黑。 */
body.dark .ap-modal {
  /* 不用 --line（深色的 #232a34 和面板 #161a21 几乎同色，等于没画）；
     浮层描边用白色低透明度，深浅一致、也不受主题色切换影响 */
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
}
/* 抽屉贴边且满高，只有左侧那一道是真正的边界 */
body.dark .ap-modal.ap-drawer {
  border-width: 0 0 0 1px;
  box-shadow: -18px 0 48px rgba(0, 0, 0, .5);
}
@keyframes ap-pop { from { transform: translateY(-6px); opacity: .6; } to { transform: none; opacity: 1; } }
.ap-modal-head { display: flex; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.ap-modal-head h3 { margin: 0; font-size: 15.5px; font-weight: 600; flex: 1 1 auto; }
.ap-modal-body { padding: 18px; max-height: 66vh; overflow-y: auto; }
.ap-modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); }

/* 右侧抽屉：靠右贴边、占满视口高度、从右滑出（模块配置等长表单用） */
.ap-modal-root.is-drawer {
  align-items: stretch; justify-content: flex-end;
  padding: 0; overflow: hidden;
  animation: ap-fade-in .18s ease-out; /* 与关闭时的淡出对称 */
  /* 抽屉模式不要毛玻璃：背景表格被 blur 化开后是一团糊掉的彩色色块（看着脏），
     直接压暗更干净，也让注意力全落在右侧表单上 */
  background: rgba(15, 23, 42, .62);
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
@keyframes ap-fade-in { from { opacity: 0; } to { opacity: 1; } }
.ap-modal.ap-drawer {
  width: 480px; max-width: 92vw; height: 100%;
  border-radius: 0; display: flex; flex-direction: column;
  animation: ap-slide-in .22s cubic-bezier(.22, .61, .36, 1);
}
@keyframes ap-slide-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
/* 关闭：抽屉往右收回 + 遮罩淡出（JS 打上 .is-closing，动画结束后才真正卸载） */
.ap-modal-root.is-closing { animation: ap-fade-out .2s ease-in forwards; }
.ap-modal-root.is-closing .ap-modal.ap-drawer {
  animation: ap-slide-out .2s cubic-bezier(.55, .06, .68, .19) forwards;
}
@keyframes ap-slide-out { from { transform: translateX(0); } to { transform: translateX(100%); } }
@keyframes ap-fade-out { from { opacity: 1; } to { opacity: 0; } }
.ap-modal.ap-drawer > .ap-modal-head { flex: 0 0 auto; }
.ap-modal.ap-drawer > .ap-modal-body { flex: 1 1 auto; max-height: none; overflow-y: auto; }
.ap-modal.ap-drawer > .ap-modal-foot { flex: 0 0 auto; }
@media (max-width: 560px) { .ap-modal.ap-drawer { width: 100%; max-width: 100%; } }

/* 超窄屏（<500px）：顶栏一行放不下面包屑 + 搜索框 + 右侧按钮，
   面包屑直接隐藏（display:none 不占位），把宽度让给搜索框和操作按钮 */
@media (max-width: 500px) {
  .ap-crumb { display: none; }
}

.ap-perm-group { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 12px; }
.ap-perm-group h4 { margin: 0 0 10px; font-size: 13px; color: var(--ink-2); }
.ap-perm-group-head { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; margin-bottom: 10px; }
.ap-perm-caret { color: var(--ink-3); font-size: 12px; width: 12px; text-align: center; }
.ap-perm-group-name { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.ap-perm-group-head .ap-spacer { flex: 1 1 auto; }
.ap-perm-all { font-size: 12.5px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.ap-perm-all input { margin: 0; }
.ap-perm-count { font-size: 12px; color: var(--ink-3); }
.ap-perm-head-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.ap-perm-head-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.ap-perm-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
.ap-perm-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); }

/* ------------------------------------------------------------ 开关（替代单选） */
.ap-switch {
  display: inline-flex; align-items: center; gap: 9px;
  cursor: pointer; user-select: none; min-height: 30px;
}
.ap-switch input[type="checkbox"] {
  position: absolute; width: 0; height: 0; opacity: 0; margin: 0; pointer-events: none;
}
.ap-switch-track {
  position: relative; flex: 0 0 auto;
  width: 42px; height: 23px; border-radius: 999px;
  background: #cdd3de;
  transition: background .18s ease;
}
.ap-switch-track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 19px; height: 19px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(16, 24, 40, .28);
  transition: transform .18s ease;
}
.ap-switch input:checked + .ap-switch-track { background: var(--brand); }
.ap-switch input:checked + .ap-switch-track::after { transform: translateX(19px); }
.ap-switch input:focus-visible + .ap-switch-track { box-shadow: 0 0 0 3px var(--brand-soft); }
.ap-switch-text { font-size: 13px; color: var(--ink-3); line-height: 1.2; }
.ap-switch-text b { font-weight: 500; }
.ap-switch-text .on { display: none; color: var(--brand); }
.ap-switch input:checked ~ .ap-switch-text .on { display: inline; }
.ap-switch input:checked ~ .ap-switch-text .off { display: none; }
.ap-switch.is-disabled { cursor: not-allowed; opacity: .55; }

/* ---------------------------------------------------------------- 提示条 */
/* 同理：全屏编辑时上传成功的提示也要能看见 */
.ap-toasts { position: fixed; right: 18px; bottom: 18px; z-index: 1220; display: flex; flex-direction: column; gap: 8px; }
.ap-toast {
  min-width: 200px; max-width: 360px;
  padding: 10px 14px; border-radius: 9px;
  background: #111827; color: #f8fafc; font-size: 13px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, .3);
  animation: ap-slide .18s ease-out;
}
.ap-toast.ap-toast-error { background: #7f1d1d; }
.ap-toast.ap-toast-ok { background: #14532d; }
@keyframes ap-slide { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.ap-loading { padding: 40px; text-align: center; color: var(--ink-3); }
.ap-skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, #eef1f6, #f7f9fc, #eef1f6); background-size: 200% 100%; animation: ap-shimmer 1.2s infinite; }
@keyframes ap-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------------------------------------------------------------- 登录页 */
.ap-login-body {
  min-height: 100vh; margin: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 20% -10%, #e6e9ff 0%, transparent 55%),
              radial-gradient(900px 500px at 110% 110%, #e8f1ff 0%, transparent 50%),
              #f4f6fa;
  padding: 24px;
}
.ap-login-wrap { width: 100%; max-width: 380px; }
.ap-login-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, .10);
  padding: 30px 28px 24px;
}
.ap-login-head { text-align: center; margin-bottom: 22px; }
.ap-login-logo { width: 44px; height: 44px; object-fit: contain; margin-bottom: 8px; }
.ap-login-head h1 { margin: 10px 0 2px; font-size: 18px; font-weight: 650; }
.ap-login-head p { margin: 0; color: var(--ink-3); font-size: 12.5px; }
.ap-login-error {
  margin: 0 0 12px; padding: 9px 12px; border-radius: 8px;
  background: var(--danger-soft); color: var(--danger); font-size: 12.5px;
}
.ap-login-foot { margin-top: 18px; text-align: center; color: var(--ink-3); font-size: 12px; }

/* ---------------------------------------------------------------- 文章编辑 */
.ap-editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .ap-editor-grid { grid-template-columns: 1fr; } }
.ap-editor-content textarea { min-height: 340px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.ap-sticky { position: sticky; top: 74px; }

/* ---------------------------------------------------------------- 富文本编辑器 */
.ap-rte { border: 1px solid var(--line); border-radius: 9px; background: var(--panel); overflow: hidden; }
.ap-rte:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.ap-rte-toolbar {
  position: relative;
  display: flex; align-items: center; flex-wrap: wrap; gap: 2px;
  padding: 6px 8px; background: var(--panel-2); border-bottom: 1px solid var(--line);
}
.ap-rte-btn {
  appearance: none; border: 1px solid transparent; background: transparent;
  color: var(--ink-2); height: 28px; min-width: 28px; padding: 0 8px;
  border-radius: 6px; font: inherit; font-size: 12.5px; line-height: 1;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.ap-rte-btn:hover { background: var(--hover); color: var(--ink); }
.ap-rte-btn.is-active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.ap-rte-btn i { font-size: 12.5px; line-height: 1; }
/* H2 / H3：标题图标 + 上标数字 */
.ap-rte-icon-text { font-size: 10px; font-weight: 700; line-height: 1; margin-left: 1px; position: relative; top: 2px; }
.ap-rte-sep { width: 1px; height: 18px; background: var(--line); margin: 0 5px; }
/* 文字色 / 背景色浮层里的色板 */
.ap-rte-swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin: 6px 0 10px; }
.ap-rte-swatch {
  height: 22px; padding: 0; border: 1px solid var(--line); border-radius: 5px;
  cursor: pointer; transition: transform .12s ease, border-color .12s ease;
}
.ap-rte-swatch:hover { border-color: var(--brand); transform: scale(1.08); }
.ap-rte-pop input[type="color"] {
  width: 46px; height: 28px; padding: 2px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--field); cursor: pointer;
}
.ap-rte-body {
  padding: 12px 14px; outline: none; min-height: 320px; max-height: 70vh; overflow-y: auto;
  font-size: 14px; line-height: 1.75; color: var(--ink);
}
.ap-rte-body.is-empty::before { content: attr(data-placeholder); color: var(--ink-3); pointer-events: none; }
.ap-rte-body p { margin: 0 0 10px; }
.ap-rte-body h2 { font-size: 20px; margin: 18px 0 10px; line-height: 1.4; }
.ap-rte-body h3 { font-size: 17px; margin: 16px 0 8px; line-height: 1.4; }
.ap-rte-body blockquote {
  margin: 12px 0; padding: 8px 14px; border-left: 3px solid var(--brand);
  background: var(--brand-soft); color: var(--ink-2); border-radius: 0 6px 6px 0;
}
.ap-rte-body pre {
  margin: 12px 0; padding: 12px 14px; background: #0f172a; color: #e2e8f0;
  border-radius: 8px; overflow-x: auto; font-size: 13px; line-height: 1.6;
}
.ap-rte-body code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; font-size: .92em; }
.ap-rte-body pre code { background: none; padding: 0; color: inherit; }
.ap-rte-body img { max-width: 100%; height: auto; border-radius: 6px; }
.ap-rte-body ul, .ap-rte-body ol { margin: 0 0 10px; padding-left: 22px; }
.ap-rte-body a { text-decoration: underline; }
.ap-rte-body hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.ap-rte-source {
  display: none; width: 100%; min-height: 320px; border: 0; outline: none; resize: vertical;
  padding: 12px 14px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px; line-height: 1.7; color: var(--ink);
}
.ap-rte.is-source .ap-rte-body { display: none; }
.ap-rte.is-source .ap-rte-source { display: block; }

/* 富文本：「图片」下拉菜单（本地上传 / 附件库 / 图片地址） */
.ap-rte-menu {
  position: absolute; z-index: 40;
  min-width: 138px; padding: 4px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 12px 28px rgba(23, 28, 47, .14);
}
.ap-rte-menu button {
  display: block; width: 100%; text-align: left; white-space: nowrap;
  appearance: none; border: 0; background: transparent; font: inherit; font-size: 13px;
  color: var(--ink-2); padding: 7px 10px; border-radius: 6px; cursor: pointer;
}
.ap-rte-menu button:hover { background: var(--hover); color: var(--ink); }

/* 浮层里的表单（「链接」输入地址） */
.ap-rte-menu.ap-rte-pop { min-width: 246px; padding: 8px; }
.ap-rte-pop-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.ap-rte-pop-field input {
  width: 100%; height: 30px; padding: 0 9px; border: 1px solid var(--line);
  border-radius: 6px; font: inherit; font-size: 13px; color: var(--ink); outline: none;
}
.ap-rte-pop-field input:focus { border-color: #b9bdf5; box-shadow: 0 0 0 3px var(--brand-soft); }
.ap-rte-pop-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.ap-rte-pop-label { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
.ap-rte-pop-row select {
  flex: 1; height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px;
  font: inherit; font-size: 13px; color: var(--ink); background: var(--panel); outline: none; cursor: pointer;
}
.ap-rte-pop-row select:focus { border-color: #b9bdf5; box-shadow: 0 0 0 3px var(--brand-soft); }
.ap-rte-pop-foot { display: flex; justify-content: flex-end; gap: 6px; }
.ap-rte-pop-foot button {
  display: inline-flex; align-items: center; justify-content: center;
  width: auto; height: 28px; padding: 0 14px; text-align: center;
  border: 1px solid var(--line); border-radius: 6px; background: var(--panel);
  font: inherit; font-size: 12.5px; color: var(--ink-2); cursor: pointer;
}
.ap-rte-pop-foot button:hover { background: var(--hover); color: var(--ink); }
.ap-rte-pop-foot .ap-rte-pop-ok { background: var(--brand); border-color: var(--brand); color: #fff; }
.ap-rte-pop-foot .ap-rte-pop-ok:hover { background: var(--brand); color: #fff; opacity: .92; }

/* 富文本：全屏编辑（Esc 退出） */
.ap-rte.is-fullscreen {
  position: fixed; inset: 0; z-index: 1200; border-radius: 0; border-color: transparent;
  display: flex; flex-direction: column;
}
.ap-rte.is-fullscreen .ap-rte-toolbar { flex: 0 0 auto; padding: 8px 10px; }
.ap-rte.is-fullscreen .ap-rte-body { flex: 1 1 auto; min-height: 0; max-height: none; overflow-y: auto; }
.ap-rte.is-fullscreen .ap-rte-source { flex: 1 1 auto; min-height: 0; }

/* ---------------------------------------------------------------- 选项卡（TAB） */
.ap-tabs {
  display: flex; align-items: flex-end; gap: 2px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  margin: 0 0 16px;
}
.ap-tab {
  position: relative; margin-bottom: -1px;
  appearance: none; border: 0; border-bottom: 2px solid transparent;
  background: transparent; border-radius: 8px 8px 0 0;
  padding: 9px 14px; font: inherit; font-size: 13.5px; line-height: 1.4;
  color: var(--ink-2); cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.ap-tab:hover { color: var(--ink); background: var(--hover); }
.ap-tab:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.ap-tab.is-active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; background: transparent; }
.ap-tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--panel-2); color: var(--ink-3);
  font-size: 11px; font-style: normal; font-weight: 500; line-height: 1;
}
.ap-tab.is-active .ap-tab-count { background: var(--brand-soft); color: var(--brand); }
.ap-tab-panel[hidden] { display: none; }


.ap-divider { height: 1px; background: var(--line); margin: 16px 0; }
.ap-muted { color: var(--ink-3); font-size: 12.5px; }
.ap-row { display: flex; align-items: center; gap: 8px; }
/* .ap-spacer 的 flex:1 原先只在 .ap-toolbar / .ap-pager 等容器里定义过，
   用到 .ap-row 上时它是 0 宽，右侧内容撑不到边上（联动菜单那条工具条就空了 256px） */
.ap-row .ap-spacer { flex: 1 1 auto; }

/* ---------- 附件管理 ---------- */
.ap-chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center;margin-bottom:12px; }
.ap-chips-label { color: var(--ink-3); font-size: 12.5px; min-width: 52px; }
.ap-chip {
  border: 1px solid var(--line); background: var(--panel); color: var(--ink-2);
  border-radius: 999px; padding: 4px 13px; font-size: 12.5px; cursor: pointer;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.ap-chip:hover { border-color: var(--brand); color: var(--brand); }
.ap-chip.is-active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 500; }
/* chip 上的删除小叉（联动菜单数据源） */
.ap-chip .ap-chip-x { font-style: normal; margin-left: 7px; opacity: .5; }
.ap-chip .ap-chip-x:hover { opacity: 1; color: var(--danger); }
.ap-chip.is-active .ap-chip-x:hover { color: #fff; }

.ap-attach-main{min-height: calc( 100vh - 320px);}
/* 「图片 / 列表」视图切换：两个胶囊拼成一个分段控件（iOS segmented 那种）。
   外层灰凹槽 + 选中项浮起填满，视觉上是一个整体控件，不像两个独立按钮。 */
.ap-attach-view {
  display: inline-flex; align-items: center; gap: 2px; flex: 0 0 auto;
  padding: 3px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel-2);
}
.ap-attach-view button {
  border: 0; background: transparent; color: var(--ink-2);
  border-radius: 999px; padding: 5px 15px; font-size: 12.5px; cursor: pointer;
  transition: color .15s ease, background .15s ease, box-shadow .15s ease;
}
.ap-attach-view button:hover { color: var(--brand); }
.ap-attach-view button.is-active {
  background: var(--brand); color: #fff; font-weight: 500;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .14);
}
.ap-attach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.ap-attach-card {
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel); overflow: hidden;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.ap-attach-card:hover { border-color: #d6dce8; box-shadow: 0 4px 14px rgba(15, 23, 42, .07); }
.ap-attach-thumb {
  position: relative; height: 112px; background: var(--panel-2);
  display: flex; align-items: center; justify-content: center; cursor: zoom-in;
}
.ap-attach-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ap-attach-ext { font-size: 20px; font-weight: 700; color: #9aa7ba; letter-spacing: .02em; }
.ap-attach-flag {
  position: absolute; top: 8px; right: 8px;
  font-size: 11px; line-height: 1; padding: 4px 8px; border-radius: 999px;
  background: rgba(255, 255, 255, .92); color: var(--ink-3); pointer-events: none;
}
.ap-attach-flag.used { background: var(--ok-soft); color: var(--ok); }
.ap-attach-flag.unused { background: rgba(241, 244, 249, .95); }
.ap-attach-body { padding: 10px 12px 12px; }
.ap-attach-name {
  font-size: 13px; color: var(--ink); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.ap-attach-meta { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.ap-attach-ops { display: flex; gap: 12px; margin-top: 9px; }
.ap-attach-ops .op {
  border: 0; background: none; padding: 0; font-size: 12.5px; cursor: pointer; color: var(--brand);
}
.ap-attach-ops .op.op-copy { color: var(--ok); }
.ap-attach-ops .op.op-del { color: var(--danger); }
.ap-attach-ops .op:hover { text-decoration: underline; }

.ap-thumb-sm { width: 42px; height: 42px; object-fit: cover; border-radius: 6px; background: var(--panel-2); display: block; }
.ap-thumb-sm.ap-thumb-file {
  display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 700; color: #9aa7ba; text-transform: uppercase;
}

.ap-upload-box {
  border: 2px dashed var(--line); border-radius: 10px; padding: 26px 16px;
  text-align: center; color: var(--ink-3); font-size: 13px; cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.ap-upload-box:hover, .ap-upload-box.is-drag { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.ap-upload-box input[type="file"] { display: none; }

/* 附件筛选卡：文本类控件不占满整行，收在一行内 */
.ap-attach-filter{margin-bottom:14px;}
.ap-attach-filter input,
.ap-attach-filter select { width: auto; }
.ap-attach-filter input[type="search"] { width: 220px; }
.ap-attach-filter input[type="date"] { width: 145px; }
.ap-attach-filter select { width: auto; min-width: 120px; }
.ap-attach-filter .ap-row { flex-wrap: wrap; row-gap: 8px; }

/* ---------- 应用管理 ---------- */
/* 1fr 让「所有行」等高：默认只保证同一行内等高，操作区矮的卡（未安装/核心）
   所在行会比别行低 8px，整墙看着就还是不齐 */
.ap-addon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); grid-auto-rows: 1fr; gap: 14px; }
.ap-addon-card { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 16px; }
.ap-addon-head { display: flex; align-items: center; gap: 12px; }
.ap-addon-icon {
  width: 44px; height: 44px; border-radius: 10px; flex: 0 0 auto;
  background: var(--brand-soft); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700;
}
.ap-addon-title { flex: 1 1 auto; min-width: 0; }
.ap-addon-name { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-addon-key { color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.ap-addon-head .ap-btn { flex: 0 0 auto; }
/* 功能/权限点区域锁死三行：菜单多的模块会把卡片撑得比别的高，整墙卡片就参差不齐。
   不足三行留白（占位），超出三行截断并加省略号，完整内容用 title 悬浮看。 */
.ap-addon-meta {
  margin-top: 12px; font-size: 12.5px; color: var(--ink-3); line-height: 1.7;
  height: 5.1em; /* 1.7 × 3 行 */
  overflow: hidden;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3;
}
.ap-addon-foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
/* 操作区整组靠右、不换行：卸载按钮永远在最右边 */
.ap-addon-ops {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 10px; margin-left: auto; flex-wrap: nowrap;
}

/* 应用管理：卡片 / 列表 视图切换胶囊 */
.ap-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; align-self: center; }
.ap-seg button { border: 0; background: transparent; padding: 6px 16px; cursor: pointer; font-size: 13px; color: var(--ink-3); transition: background .15s, color .15s; }
.ap-seg button + button { border-left: 1px solid var(--line); }
.ap-seg button.is-active { background: var(--brand, #2563eb); color: #fff; }

/* 应用管理：列表视图（XunRuiCMS 风格表格） */
.ap-addon-list { overflow-x: auto; }
.ap-addon-table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; font-size: 13.5px; }
.ap-addon-table th, .ap-addon-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.ap-addon-table thead th { background: var(--panel-2, #f8fafc); color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.ap-addon-table tbody tr:last-child td { border-bottom: 0; }
.ap-addon-table tbody tr:hover { background: var(--panel-2, #f8fafc); }
.ap-addon-th-icon, .ap-addon-td-icon { width: 1%; white-space: nowrap; }
.ap-addon-td-icon .ap-addon-icon { width: 36px; height: 36px; font-size: 17px; }
.ap-addon-th-ops, .ap-addon-td-ops { width: 1%; white-space: nowrap; text-align: right; }
.ap-addon-td-ops .ap-addon-ops { justify-content: flex-end; margin-left: 0; }
.ap-addon-td-menu { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-3); }
.ap-addon-td-perms { white-space: nowrap; color: var(--ink-3); }
/* 应用 / 插件 类型列：与权限点列同款灰字，不抢主列的注意力 */
.ap-addon-td-type { white-space: nowrap; color: var(--ink-3); }

/* ---------- 自定义字段 · 商城/高级控件 ---------- */
.ap-adv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 8px; }
.ap-sku-table input { min-height: 30px; padding: 4px 8px; font-size: 13px; background: var(--panel); }
.ap-sku-table { margin-bottom: 10px; }
.ap-sku-table th, .ap-sku-table td { padding: 6px 8px; }
.ap-step { display: flex; align-items: center; gap: 8px; }
.ap-step input { width: 90px; text-align: center; }
.ap-pick-preview { width: 92px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); margin-top: 6px; }

/* 上传字段：输入框 + 按钮必须同一行（input 全局 width:100% 会把按钮挤下去） */
.ap-upload-row { flex-wrap: nowrap; }
.ap-upload-row input { flex: 1 1 auto; width: auto; min-width: 0; }
.ap-upload-row .ap-btn { flex: 0 0 auto; white-space: nowrap; }
.ap-upload-row .ap-muted { flex: 0 0 auto; white-space: nowrap; }
.ap-files-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.ap-file-item { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; background: var(--panel); }
.ap-file-badge {
  flex: 0 0 auto; min-width: 34px; text-align: center; padding: 3px 6px;
  border-radius: 6px; background: var(--panel-2); color: var(--ink-2);
  font-size: 10.5px; font-weight: 700;
}
.ap-file-name { flex: 1 1 auto; font-size: 12.5px; color: var(--brand); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-file-item .op-del { border: 0; background: none; color: var(--danger); font-size: 12px; cursor: pointer; }

/* 附件库选择器 */
.ap-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; max-height: 52vh; overflow-y: auto; }
.ap-picker-item { border: 2px solid var(--line); border-radius: 10px; padding: 6px; cursor: pointer; background: var(--panel); }
.ap-picker-item.is-active { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.ap-picker-thumb { height: 84px; background: var(--panel-2); border-radius: 6px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.ap-picker-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* 联动菜单管理 */
/* 联动菜单：表格化 —— 层级缩进 + 行首折叠箭头（收起时子孙行不渲染） */
.ap-lk-table td { vertical-align: middle; }
.ap-lk-indent { display: inline-block; flex: 0 0 auto; }
.ap-lk-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; margin-right: 6px; vertical-align: middle;
  border: 0; background: none; padding: 0; cursor: pointer; color: var(--ink-3);
}
.ap-lk-toggle::before {
  content: ''; width: 0; height: 0;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  transition: transform .15s ease;
}
.ap-lk-toggle.is-open::before { transform: rotate(90deg); } /* 展开：箭头朝下 */
.ap-lk-toggle.is-leaf { cursor: default; }
.ap-lk-toggle.is-leaf::before { border: 0; }
.ap-lk-name { font-size: 13.5px; }
.ap-lk-param, .ap-lk-sort { color: var(--ink-2); }

/* 联动菜单：左数据源侧栏 + 右数据表（迅睿风两栏） */
.ap-lk-layout { display: flex; gap: 16px; align-items: flex-start; }
.ap-lk-side { width: 230px; flex: 0 0 230px; padding: 12px; max-height: calc(100vh - 150px); overflow-y: auto; }
.ap-lk-side-head { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 10px; }
.ap-lk-srcs { display: flex; flex-direction: column; gap: 4px; }
.ap-lk-src {
  display: flex; align-items: center; gap: 8px; width: 100%;
  border: 1px solid transparent; border-radius: 8px; background: none;
  padding: 8px 10px; cursor: pointer; text-align: left; color: var(--ink-2);
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.ap-lk-src:hover { background: var(--hover); }
.ap-lk-src.is-active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); font-weight: 600; }
.ap-lk-src-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.ap-lk-src-code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; color: var(--ink-3); flex: 0 0 auto; }
.ap-lk-src.is-active .ap-lk-src-code { color: var(--brand); }
.ap-lk-src-del { flex: 0 0 auto; color: var(--ink-3); font-style: normal; font-size: 12px; padding: 2px 5px; border-radius: 4px; }
.ap-lk-src-del:hover { color: #d23b3b; background: rgba(210, 59, 59, .12); }
.ap-lk-side-foot { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.ap-lk-empty { color: var(--ink-3); font-size: 13px; padding: 8px 2px; }
.ap-lk-main { flex: 1 1 auto; min-width: 0; } /* min-width:0 让表格横向溢出可滚动而非撑破布局 */
@media (max-width: 820px) {
  .ap-lk-layout { flex-direction: column; }
  .ap-lk-side { width: 100%; flex: none; max-height: none; }
}

/*
 * 仪表盘（按后台体系分层）：欢迎条 / 内容概览 / 功能体系 / 内容动态 / 运行状态。
 * 全部用 :root 变量，深色模式自动跟随；三档断点：1180 上下排、1000 KPI 两列、720 手机。
 */
/* 整页控制在「一屏左右」：gap 与各卡内边距都按紧凑档给，别再加高 */
.ap-dash2 { display: flex; flex-direction: column; gap: 12px; }

/* ---------- 欢迎条 ---------- */
.ap-dash-hero {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 12px 18px; border-radius: 12px; color: #fff;
  background: linear-gradient(120deg, #4338ca, #4f46e5 55%, #6d5cf0);
  box-shadow: 0 8px 20px rgba(79, 70, 229, .18);
}
.ap-dash-hero::after {
  content: ''; position: absolute; right: -80px; top: -120px;
  width: 300px; height: 300px; border-radius: 50%; background: rgba(255, 255, 255, .08);
}
.ap-dash-hero-l, .ap-dash-hero-r { position: relative; z-index: 1; }
.ap-dash-hello { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; font-size: 18px; font-weight: 650; }
.ap-dash-role {
  padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 500;
  background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .28);
}
.ap-dash-sub { margin-top: 4px; font-size: 12.5px; color: rgba(255, 255, 255, .82); }
.ap-dash-hero-r { display: flex; gap: 8px; flex-wrap: wrap; }
.ap-dh-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px;
  font-size: 13px; cursor: pointer; text-decoration: none; white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, .32); background: rgba(255, 255, 255, .12); color: #fff;
}
.ap-dh-btn:hover { background: rgba(255, 255, 255, .22); color: #fff; }
.ap-dh-btn.primary { background: #fff; color: #4338ca; border-color: #fff; font-weight: 600; }
.ap-dh-btn.primary:hover { background: #f1f0ff; color: #4338ca; }

/* ---------- 区块标题 ---------- */
.ap-ds-head { display: flex; align-items: baseline; gap: 10px; margin: 0 0 -6px; flex-wrap: wrap; }
.ap-ds-head h2 { margin: 0; font-size: 14px; font-weight: 650; }
.ap-ds-head span { font-size: 12px; color: var(--ink-3); }

/* ---------- 内容概览：4 张主 KPI ---------- */
.ap-dk-grid { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ap-dk {
  position: relative; overflow: hidden; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 14px; box-shadow: var(--shadow);
}
.ap-dk::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand); }
.ap-dk-ok::before { background: var(--ok); }
.ap-dk-warn::before { background: var(--warn); }
.ap-dk-violet::before { background: #8b5cf6; }
.ap-dk-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ap-dk-label { font-size: 12px; color: var(--ink-3); }
.ap-dk-ic { font-size: 16px; color: var(--brand); opacity: .55; }
.ap-dk-ok .ap-dk-ic { color: var(--ok); }
.ap-dk-warn .ap-dk-ic { color: var(--warn); }
.ap-dk-violet .ap-dk-ic { color: #8b5cf6; }
/* 数字与说明同行：一张卡从三行降到两行，4 张 KPI 一共省掉 ~90px */
.ap-dk-line { display: flex; align-items: baseline; gap: 8px; margin-top: 1px; }
.ap-dk-value { font-size: 22px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; }
.ap-dk-foot { min-width: 0; font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-dk-bar { margin-top: 6px; height: 4px; border-radius: 999px; background: var(--hover); overflow: hidden; }
.ap-dk-bar i { display: block; height: 100%; border-radius: 999px; background: var(--brand); }

/* 资源规模：一行小指标 */
.ap-dm-metrics { display: flex; flex-wrap: wrap; gap: 5px; }
.ap-dmetric {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel);
  font-size: 11.5px; color: var(--ink-2);
}
.ap-dmetric i { color: var(--brand); opacity: .7; font-size: 11.5px; }
.ap-dmetric b { font-size: 13px; font-weight: 650; color: var(--ink); }

/* ---------- 功能体系地图 ---------- */
.ap-dm-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
/* 左栏里固定两列：auto-fill 会在宽屏挤出 3 列，第 4 个模块单独占一行，右边留一大片空 */
.ap-dash-split-main .ap-dm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 1fr; }
/* 默认 2×2 个模块，其余折叠——和右栏运行状态高度对齐，一屏看完 */
.ap-dm-grid.collapsed > .ap-dm-col:nth-child(n+5) { display: none; }
/* 卡片够宽（约 400px），链接排两列：同样 6 项只占 3 行高，模块卡更扁 */
.ap-dash-split-main .ap-dm-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 6px; }
.ap-dash-split-main .ap-dm-more { grid-column: 1 / -1; }
/* 两列时链接必须单行：菜单名长一点就换行会把卡片撑高、两列还会错位 */
.ap-dash-split-main .ap-dm-link { white-space: nowrap; overflow: hidden; }
.ap-dash-split-main .ap-dm-link i { flex: 0 0 auto; }
.ap-dm-col {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.ap-dm-hd {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border-bottom: 1px solid var(--line); background: var(--panel-2);
}
.ap-dm-ic {
  width: 24px; height: 24px; border-radius: 7px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand); font-size: 12px;
}
.ap-dm-name { flex: 1 1 auto; min-width: 0; font-size: 13px; font-weight: 650; }
.ap-dm-num {
  min-width: 20px; height: 18px; line-height: 18px; text-align: center; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand); font-size: 11px;
}
.ap-dm-list { display: flex; flex-direction: column; padding: 5px 6px; }
.ap-dm-link {
  display: flex; align-items: center; gap: 6px; padding: 4px 7px; border-radius: 6px;
  color: var(--ink-2); text-decoration: none; font-size: 12.5px;
}
.ap-dm-link i { font-size: 9px; color: var(--ink-3); }
.ap-dm-link:hover { background: var(--hover); color: var(--brand); }
.ap-dm-more { padding: 4px 7px; font-size: 11.5px; color: var(--ink-3); }
/* 展开/收起：虚线按钮，别抢视觉重量 */
.ap-dash-expand {
  align-self: flex-start; padding: 5px 12px; cursor: pointer;
  border: 1px dashed var(--line); border-radius: 8px; background: transparent;
  color: var(--ink-2); font-size: 12.5px;
}
.ap-dash-expand:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.ap-dm-empty { padding: 20px; font-size: 13px; color: var(--ink-3); }

/* ---------- 运行状态（左环境 / 右待办，一张卡两栏） ---------- */
.ap-dash-head { flex-wrap: wrap; row-gap: 8px; }
/* 加 .ap-card-body 提权：ap-tight 的 padding:0 是两条类选择器，会盖掉单类的 */
.ap-card-body.ap-dash-sysbody { padding: 2px 14px 6px; }
/* 功能体系（左）/ 运行状态（右）并排 */
.ap-dash-split { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(0, 1.55fr); gap: 12px; align-items: stretch; }
/* 左：运行状态（窄栏） */
.ap-dash-split-aside { min-width: 0; display: flex; }
.ap-dash-split-aside > .ap-card { flex: 1 1 auto; display: flex; flex-direction: column; }
/* 卡片跟功能体系等高：待办区 margin-top:auto 贴底，两栏底边对齐 */
.ap-dash-split-aside .ap-dash-sysbody { flex: 1 1 auto; }
.ap-dash-split-aside .ap-dash-sys { display: flex; flex-direction: column; height: 100%; }
/* 右：功能体系 */
.ap-dash-split-main { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.ap-dash-split-main .ap-ds-head { margin-bottom: -2px; }

/* 运行状态：键值两列（右栏约 400px，每列 190px 够放短标签） */
.ap-dash-sys-col { min-width: 0; }
.ap-dash-sys-col + .ap-dash-sys-col {
  margin-top: auto; padding-top: 6px; border-top: 1px dashed var(--line);
}
.ap-sys-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.ap-sys-stamp { font-size: 11.5px; color: var(--ink-3); font-family: ui-monospace, Menlo, Consolas, monospace; }
.ap-sys2-grp {
  margin: 8px 0 1px; font-size: 11px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-3);
}
.ap-sys2-grp:first-child { margin-top: 2px; }
.ap-sys-tag {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 6px;
  font-family: inherit; font-size: 11px; line-height: 1.5;
}
.ap-sys-tag.ok { background: var(--ok-soft); color: var(--ok); }
.ap-sys-tag.warn { background: var(--warn-soft); color: var(--warn); }
.ap-sys-tag.off { background: var(--hover); color: var(--ink-3); }
/* 待办区嵌在卡片里，行内不要再吃横向内边距 */
.ap-dash-sys .ap-dtodo-row { padding: 6px 0; }
.ap-sys-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 3px 0; border-bottom: 1px dashed var(--line); font-size: 12px; }
.ap-sys-row:last-child { border-bottom: 0; }
.ap-sys-k { color: var(--ink-3); white-space: nowrap; }
/* 值单行省略：数据库版本这类长串不能把行撑成两行（撑一行就多 18px） */
.ap-sys-v {
  min-width: 0; color: var(--ink); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 待办与提示 */
.ap-dtodo-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 12px;
  border-bottom: 1px dashed var(--line); text-decoration: none; color: var(--ink-2);
}
.ap-dtodo-row:last-child { border-bottom: 0; }
a.ap-dtodo-row:hover { background: var(--hover); }
.ap-dtodo-ic {
  width: 26px; height: 26px; border-radius: 7px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand); font-size: 12px;
}
.ap-dtodo-ic.warn { background: var(--warn-soft); color: var(--warn); }
.ap-dtodo-ic.ok { background: var(--ok-soft); color: var(--ok); }
.ap-dtodo-b { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.ap-dtodo-b b { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.ap-dtodo-b small { margin-top: 1px; font-size: 11px; color: var(--ink-3); }
.ap-dtodo-go { color: var(--ink-3); font-size: 10px; }
.ap-dtodo-static { cursor: default; }

/* ---------- 响应式 ---------- */
/* 窄屏放不下左右两栏：功能体系在上、运行状态在下 */
@media (max-width: 1100px) {
  .ap-dash-split { grid-template-columns: 1fr; }
}
@media (max-width: 1000px) { .ap-dk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) {
  .ap-dash-hero { padding: 14px 16px; }
  .ap-dash-hello { font-size: 17px; }
  .ap-sys-grid { grid-template-columns: 1fr; }
}
@media (max-width: 460px) { .ap-dk-grid { grid-template-columns: 1fr; } }
.ap-lk-ops { white-space: nowrap; text-align: right; }

/* 缩略图字段（文章=封面图，产品=缩略图）：预览 + 附件库选择 */
.ap-thumb-row { display: flex; gap: 10px; align-items: flex-start; }
.ap-thumb-preview { width: 88px; height: 66px; flex: 0 0 88px; display: flex; align-items: center; justify-content: center; overflow: hidden; border: 1px dashed var(--line); border-radius: 8px; background: var(--hover); font-size: 11px; }
.ap-thumb-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ap-thumb-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.ap-thumb-actions { display: flex; gap: 6px; }
/* 列表里的缩略图小图（产品管理等） */
.ap-thumb-mini { width: 46px; height: 32px; display: block; object-fit: cover; border: 1px solid var(--line); border-radius: 4px; }
/* 字段管理：系统内置字段行 */
.ap-row-system td { background: rgba(148, 163, 184, .07); }

/* 图标库（系统 / 图标库）：点一下复制类名 */
.ap-icons-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.ap-icons-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: 8px; }
.ap-icon-cell {
  appearance: none; padding: 13px 8px 10px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  transition: border-color .15s, box-shadow .15s, transform .15s;
  content-visibility: auto; contain-intrinsic-size: 88px;
}
.ap-icon-cell:hover { border-color: #c9cdf7; box-shadow: 0 8px 18px rgba(23, 28, 47, .08); transform: translateY(-1px); }
.ap-icon-cell i { font-size: 19px; line-height: 1; color: var(--ink); }
.ap-icon-cell span { font-size: 11px; line-height: 1.3; color: var(--ink-3); text-align: center; word-break: break-all; }

/* 自动任务状态条（系统设置 → 自动任务权限下方）
   只给圆点着色、底色用 --field：深色模式没有 warn-soft / danger-soft，铺浅色底会瞎眼 */
.ap-cron-probe {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 8px 0 2px; padding: 8px 10px;
  background: var(--field); border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 12.5px;
}
.ap-cron-dot { width: 8px; height: 8px; border-radius: 50%; background: #9aa4b2; flex: 0 0 auto; }
.ap-cron-probe[data-level="ok"] .ap-cron-dot { background: var(--ok); }
.ap-cron-probe[data-level="warn"] .ap-cron-dot { background: var(--warn); }
.ap-cron-probe[data-level="bad"] .ap-cron-dot { background: var(--danger); }
.ap-cron-text { flex: 1 1 220px; min-width: 0; color: var(--ink); line-height: 1.5; }
