/* ============================================================================
   统一按钮层 · 2026-11-27
   ----------------------------------------------------------------------------
   目标：主站与运维台共用同一套按钮视觉，只保留 12 个角色类：
     .btn / .primary / .ghost / .danger / .accent / .success
     .sm / .lg / .icon / .block / .seg(.seg-item) / .link
   尺寸：sm 28 / md 32 / lg 36；圆角 8（sm 7）；字号 11 / 12 / 13。
   色板：primary #1677FF、hover #0958D9、accent #FA8C16、
         success #16A34A、danger #DC2626。
   ----------------------------------------------------------------------------
   这一层**最后加载**，用 !important 压住历史页面类。历史类名保留原样，
   因为 app.js / kb.js / osm.js / ops.js 里有大量 closest()/querySelector()
   依赖它们做事件分发 —— 不删钩子，只收回视觉定义。
   ========================================================================== */

:root {
  --b-primary: #1677FF;
  --b-primary-h: #0958D9;
  --b-primary-soft: #EFF6FF;
  --b-primary-bd: #BFDBFE;
  --b-accent: #FA8C16;
  --b-accent-h: #EA580C;
  --b-success: #16A34A;
  --b-success-h: #15803D;
  --b-danger: #DC2626;
  --b-danger-h: #B91C1C;
  --b-ink: #0F172A;
  --b-ink2: #475569;
  --b-ink3: #94A3B8;
  --b-line: #E2E8F0;
  --b-line-h: #CBD5E1;
  --b-bg: #FFFFFF;
  --b-bg-h: #F8FAFC;
  --b-soft: #F1F5F9;
  --b-r: 8px;
  --b-r-sm: 7px;
  --b-focus: 0 0 0 3px rgba(22, 119, 255, .18);
}

/* ---------- 1. 基座：所有动作按钮 ---------- */
.btn,
.m-btn,
.cd-btn,
.vfd-btn,
.dm-diag-btn,
.uops-b,
.rm-more-btn,
.org-pw-addbtn,
.org-pw-fbtn,
.org-cv-btn,
.org-nd,
.vecm-new-btn,
.vecm-batch-btn,
.rp-fbtn,
.kb-fmore-btn,
.osm-fbtn,
.osm-btn-sm,
.bug-ph-fbtn,
.bug-ops-btn,
.office-wk-btn,
.iconbtn,
.icon-btn,
.login-btn,
.lp2-ok,
.office-pickbar-go,
.office-dock-add,
.office-dock-save,
.office-dock-sub,
.office-pr-main,
.org-pk-go,
.kb-op,
.kb-mini,
.kb-mini-ico {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  width: auto !important;
  height: 32px !important;
  min-height: 32px !important;
  padding: 0 12px !important;
  border: 1px solid var(--b-line) !important;
  border-radius: var(--b-r) !important;
  background: var(--b-bg) !important;
  color: var(--b-ink) !important;
  font-family: "HarmonyOS Sans SC", "Source Han Sans SC", "Noto Sans CJK SC",
    "PingFang SC", "Microsoft YaHei", sans-serif !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04) !important;
  cursor: pointer !important;
  vertical-align: middle !important;
  transform: none !important;
  transition: background-color .15s, border-color .15s, color .15s !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}

.btn:hover,
.m-btn:hover,
.cd-btn:hover,
.vfd-btn:hover,
.dm-diag-btn:hover,
.uops-b:hover,
.rm-more-btn:hover,
.org-pw-addbtn:hover,
.org-pw-fbtn:hover,
.org-cv-btn:hover,
.org-nd:hover,
.vecm-new-btn:hover,
.vecm-batch-btn:hover,
.rp-fbtn:hover,
.kb-fmore-btn:hover,
.osm-fbtn:hover,
.osm-btn-sm:hover,
.bug-ph-fbtn:hover,
.bug-ops-btn:hover,
.office-wk-btn:hover,
.iconbtn:hover,
.icon-btn:hover,
.login-btn:hover {
  background: var(--b-bg-h) !important;
  border-color: var(--b-line-h) !important;
  color: var(--b-ink) !important;
  text-decoration: none !important;
}

.btn:focus-visible,
.m-btn:focus-visible,
.cd-btn:focus-visible,
.vfd-btn:focus-visible,
.dm-diag-btn:focus-visible,
.uops-b:focus-visible,
.rm-more-btn:focus-visible,
.org-pw-addbtn:focus-visible,
.org-pw-fbtn:focus-visible,
.org-cv-btn:focus-visible,
.vecm-new-btn:focus-visible,
.vecm-batch-btn:focus-visible,
.rp-fbtn:focus-visible,
.kb-fmore-btn:focus-visible,
.osm-fbtn:focus-visible,
.osm-btn-sm:focus-visible,
.bug-ph-fbtn:focus-visible,
.bug-ops-btn:focus-visible,
.office-wk-btn:focus-visible {
  outline: 2px solid var(--b-primary) !important;
  outline-offset: 2px !important;
  box-shadow: var(--b-focus) !important;
}

.btn:disabled,
.m-btn:disabled,
.cd-btn:disabled,
.vfd-btn:disabled,
.dm-diag-btn:disabled,
.uops-b:disabled,
.rm-more-btn:disabled,
.org-pw-addbtn:disabled,
.org-pw-fbtn:disabled,
.org-cv-btn:disabled,
.org-nd:disabled,
.vecm-new-btn:disabled,
.vecm-batch-btn:disabled,
.rp-fbtn:disabled,
.kb-fmore-btn:disabled,
.osm-fbtn:disabled,
.osm-btn-sm:disabled,
.bug-ph-fbtn:disabled,
.bug-ops-btn:disabled,
.office-wk-btn:disabled {
  background: var(--b-soft) !important;
  border-color: var(--b-line) !important;
  color: var(--b-ink3) !important;
  box-shadow: none !important;
  opacity: 1 !important;
  cursor: not-allowed !important;
}

/* ---------- 2. 尺寸 ---------- */
.btn.sm,
.btn.small,
.m-btn-xs,
.rp-fbtn,
.org-pw-fbtn,
.org-nd,
.bug-ph-fbtn,
.bug-ops-btn,
.office-wk-btn,
.kb-fmore-btn,
.osm-fbtn,
.osm-btn-sm,
.office-pr-main,
.org-pk-go,
.kb-mini,
.kb-mini-ico {
  height: 28px !important;
  min-height: 28px !important;
  padding: 0 10px !important;
  border-radius: var(--b-r-sm) !important;
  font-size: 11px !important;
}

.btn.lg,
.m-btn-lg,
.login-btn,
.lp2-ok {
  height: 36px !important;
  min-height: 36px !important;
  padding: 0 16px !important;
  font-size: 13px !important;
}

.btn.icon,
.iconbtn,
.icon-btn,
.bug-ops-btn,
.office-wk-btn,
.org-pk-go,
.kb-mini-ico {
  width: 32px !important;
  min-width: 32px !important;
  padding: 0 !important;
  font-size: 15px !important;
}

.btn.icon.sm,
.bug-ops-btn,
.office-wk-btn,
.org-pk-go,
.kb-mini-ico {
  width: 28px !important;
  min-width: 28px !important;
  font-size: 14px !important;
}

.btn.block,
.btn.tu-login,
.login-btn,
.lp2-ok {
  display: flex !important;
  width: 100% !important;
}

/* 运维台服务行的 4 颗操作按钮要并排，不能被撑成整行宽。 */

/* ---------- 3. 语义 ---------- */
.btn.primary,
.btn.tu-login,
.btn.sky,
.m-btn-teal,
.cd-btn--pri,
.office-summary-btn,
.office-pickbar-go,
.office-dock-sub,
.vecm-new-btn,
.org-pw-addbtn,
.login-btn,
.lp2-ok {
  background: var(--b-primary) !important;
  border-color: var(--b-primary) !important;
  color: #FFFFFF !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 6px rgba(22, 119, 255, .18) !important;
}

.btn.primary:hover,
.btn.tu-login:hover,
.btn.sky:hover,
.m-btn-teal:hover,
.cd-btn--pri:hover,
.office-summary-btn:hover,
.office-pickbar-go:hover,
.office-dock-sub:hover,
.vecm-new-btn:hover,
.org-pw-addbtn:hover,
.login-btn:hover,
.lp2-ok:hover {
  background: var(--b-primary-h) !important;
  border-color: var(--b-primary-h) !important;
  color: #FFFFFF !important;
}

.btn.primary:disabled,
.btn.tu-login:disabled,
.btn.sky:disabled,
.m-btn-teal:disabled,
.cd-btn--pri:disabled,
.office-summary-btn:disabled,
.vecm-new-btn:disabled,
.org-pw-addbtn:disabled,
.login-btn:disabled,
.lp2-ok:disabled {
  background: #DDE9F4 !important;
  border-color: #DDE9F4 !important;
  color: #8FA3B5 !important;
  box-shadow: none !important;
}

/* 橙色只给“新增 / 添加” */
.btn.accent,
.office-addproj-btn,
.office-dock-add {
  background: var(--b-accent) !important;
  border-color: var(--b-accent) !important;
  color: #FFFFFF !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 6px rgba(250, 140, 22, .18) !important;
}

.btn.accent:hover,
.office-addproj-btn:hover,
.office-dock-add:hover {
  background: var(--b-accent-h) !important;
  border-color: var(--b-accent-h) !important;
  color: #FFFFFF !important;
}

/* 绿色只给“启动 / 通过” */
.btn.success {
  background: var(--b-success) !important;
  border-color: var(--b-success) !important;
  color: #FFFFFF !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 6px rgba(22, 163, 74, .18) !important;
}

.btn.success:hover {
  background: var(--b-success-h) !important;
  border-color: var(--b-success-h) !important;
  color: #FFFFFF !important;
}

/* 红色只给“删除 / 失败” */
.btn.danger,
.btn.pk.danger,
.vecm-act.danger,
.kb-op.danger,
.kb-fopb.danger,
.osm-fieldrow-del {
  background: var(--b-danger) !important;
  border-color: var(--b-danger) !important;
  color: #FFFFFF !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 6px rgba(220, 38, 38, .16) !important;
}

.btn.danger:hover,
.btn.pk.danger:hover,
.vecm-act.danger:hover,
.kb-op.danger:hover,
.kb-fopb.danger:hover,
.osm-fieldrow-del:hover {
  background: var(--b-danger-h) !important;
  border-color: var(--b-danger-h) !important;
  color: #FFFFFF !important;
}

/* 无框次操作：rarity 高，必须靠 hover 才“长出”边界 */
.btn.ghost {
  background: transparent !important;
  border-color: transparent !important;
  color: var(--b-ink2) !important;
  box-shadow: none !important;
}

.btn.ghost:hover {
  background: var(--b-soft) !important;
  border-color: transparent !important;
  color: var(--b-ink) !important;
}

/* 历史遗留的 go / pk / open-link / org-nd：回到基座或链接语义 */
.btn.go,
.btn.pk,
.btn.open-link {
  background: var(--b-bg) !important;
  border-color: var(--b-line) !important;
  color: var(--b-ink) !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04) !important;
  font-weight: 500 !important;
}

/* ---------- 4. 文字操作 ---------- */
.linkbtn,
.link,
.lp2-lnk,
.bug-open-btn,
.office-histbtn,
.text-link {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  height: auto !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: none !important;
  color: var(--b-primary) !important;
  font-family: inherit !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  line-height: 1.5 !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  box-shadow: none !important;
  cursor: pointer !important;
}

.linkbtn:hover,
.link:hover,
.bug-open-btn:hover,
.office-histbtn:hover,
.text-link:hover {
  color: var(--b-primary-h) !important;
  text-decoration: underline !important;
  text-underline-offset: 3px !important;
}

.linkbtn.del,
.linkbtn.danger,
.link.danger,
.link-danger,
.bug-open-btn.danger {
  color: var(--b-danger) !important;
}

.linkbtn.del:hover,
.linkbtn.danger:hover,
.link.danger:hover,
.link-danger:hover {
  color: var(--b-danger-h) !important;
}

/* ---------- 5. 分段控件 ---------- */
.seg,
.bug-seg,
.dbg-seg,
.psh-seg,
.is-seg,
.vseg,
.kb-seg,
.office-pseg,
.bug-quick {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0 !important;
  height: 30px !important;
  min-height: 30px !important;
  padding: 0 !important;
  border: 1px solid var(--b-line) !important;
  border-radius: var(--b-r) !important;
  background: var(--b-bg) !important;
  overflow: hidden !important;
}

/* 容器内的分段项：共享一圈外框，项与项之间只留一根分隔线 */
.seg button,
.bug-seg button,
.dbg-seg button,
.psh-seg-b,
.is-seg-b,
.vseg-b,
.kb-seg button,
.office-pseg button,
.seg-btn,
.bug-quick-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 28px !important;
  min-height: 28px !important;
  padding: 0 11px !important;
  border: 0 !important;
  border-right: 1px solid var(--b-line) !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--b-ink2) !important;
  font-family: inherit !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  line-height: 1 !important;
  box-shadow: none !important;
  cursor: pointer !important;
  white-space: nowrap !important;
}

.seg button:last-child,
.bug-seg button:last-child,
.dbg-seg button:last-child,
.psh-seg-b:last-child,
.is-seg-b:last-child,
.vseg-b:last-child,
.kb-seg button:last-child,
.office-pseg button:last-child,
.seg-btn:last-child,
.bug-quick-btn:last-child {
  border-right: 0 !important;
}

/* 独立使用的 segbtn（没有 .seg 外框，靠自身边框成组） */
.segbtn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 28px !important;
  min-height: 28px !important;
  padding: 0 11px !important;
  border: 1px solid var(--b-line) !important;
  border-radius: 6px !important;
  background: var(--b-bg) !important;
  color: var(--b-ink2) !important;
  font-family: inherit !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  line-height: 1 !important;
  box-shadow: none !important;
  cursor: pointer !important;
  white-space: nowrap !important;
}

/* 独立的分段下拉 / ops 小分段：一圈完整边框 */
.msel-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 32px !important;
  min-height: 32px !important;
  padding: 0 12px !important;
  border: 1px solid var(--b-line) !important;
  border-radius: var(--b-r) !important;
  background: var(--b-bg) !important;
  color: var(--b-ink2) !important;
  font-family: inherit !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  line-height: 1 !important;
  box-shadow: none !important;
  cursor: pointer !important;
  white-space: nowrap !important;
}

.segbtn:hover,
.msel-btn:hover,
.seg-btn:hover,
.seg button:hover,
.bug-seg button:hover,
.dbg-seg button:hover,
.psh-seg-b:hover,
.is-seg-b:hover,
.vseg-b:hover,
.kb-seg button:hover,
.office-pseg button:hover,
.bug-quick-btn:hover {
  background: var(--b-bg-h) !important;
  color: var(--b-ink) !important;
}

.segbtn.on,
.msel-btn.on,
.seg-btn.active,
.seg button.on,
.bug-seg button.on,
.dbg-seg button.on,
.psh-seg-b.on,
.is-seg-b.on,
.vseg-b.on,
.kb-seg button.on,
.office-pseg button.on,
.bug-quick-btn.on,
.bug-quick-btn.active {
  background: var(--b-primary-soft) !important;
  color: var(--b-primary) !important;
  font-weight: 600 !important;
  box-shadow: none !important;
}

/* 跑批页：发起测试 = 启动（绿）；计划执行 = 次操作；识别 = 主操作 */
.run2 [data-run-submit],
.m-btn[data-run-submit] {
  background: var(--b-success) !important;
  border-color: var(--b-success) !important;
  color: #FFFFFF !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 6px rgba(22, 163, 74, .18) !important;
}

.run2 [data-run-submit]:hover,
.m-btn[data-run-submit]:hover {
  background: var(--b-success-h) !important;
  border-color: var(--b-success-h) !important;
  color: #FFFFFF !important;
}

.run2 [data-run-unattended],
.m-btn[data-run-unattended] {
  background: var(--b-bg) !important;
  border-color: var(--b-line) !important;
  color: var(--b-ink) !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04) !important;
}

/* ---------- 6. 暗色 ---------- */
html[data-theme="dark"] {
  --b-ink: #E2E8F0;
  --b-ink2: #CBD5E1;
  --b-ink3: #64748B;
  --b-line: #334155;
  --b-line-h: #475569;
  --b-bg: #1E293B;
  --b-bg-h: #273449;
  --b-soft: #0F172A;
  --b-primary-soft: rgba(22, 119, 255, .16);
  --b-primary-bd: #1E40AF;
}

html[data-theme="dark"] .btn,
html[data-theme="dark"] .m-btn,
html[data-theme="dark"] .cd-btn,
html[data-theme="dark"] .vfd-btn,
html[data-theme="dark"] .dm-diag-btn,
html[data-theme="dark"] .uops-b,
html[data-theme="dark"] .rm-more-btn,
html[data-theme="dark"] .org-pw-addbtn,
html[data-theme="dark"] .org-pw-fbtn,
html[data-theme="dark"] .org-cv-btn,
html[data-theme="dark"] .org-nd,
html[data-theme="dark"] .vecm-new-btn,
html[data-theme="dark"] .vecm-batch-btn,
html[data-theme="dark"] .rp-fbtn,
html[data-theme="dark"] .kb-fmore-btn,
html[data-theme="dark"] .osm-fbtn,
html[data-theme="dark"] .osm-btn-sm,
html[data-theme="dark"] .bug-ph-fbtn,
html[data-theme="dark"] .bug-ops-btn,
html[data-theme="dark"] .office-wk-btn,
html[data-theme="dark"] .seg,
html[data-theme="dark"] .bug-seg,
html[data-theme="dark"] .dbg-seg,
html[data-theme="dark"] .psh-seg,
html[data-theme="dark"] .is-seg,
html[data-theme="dark"] .vseg,
html[data-theme="dark"] .kb-seg,
html[data-theme="dark"] .office-pseg,
html[data-theme="dark"] .bug-quick {
  background: var(--b-bg) !important;
  border-color: var(--b-line) !important;
  color: var(--b-ink) !important;
}

html[data-theme="dark"] .btn.ghost {
  background: transparent !important;
  border-color: transparent !important;
  color: var(--b-ink2) !important;
}

html[data-theme="dark"] .btn.ghost:hover {
  background: #273449 !important;
  color: #FFFFFF !important;
}

html[data-theme="dark"] .btn.primary,
html[data-theme="dark"] .btn.tu-login,
html[data-theme="dark"] .btn.sky,
html[data-theme="dark"] .m-btn-teal,
html[data-theme="dark"] .cd-btn--pri,
html[data-theme="dark"] .office-summary-btn,
html[data-theme="dark"] .login-btn,
html[data-theme="dark"] .lp2-ok {
  background: var(--b-primary) !important;
  border-color: var(--b-primary) !important;
  color: #FFFFFF !important;
}

html[data-theme="dark"] .btn.accent:hover,
html[data-theme="dark"] .office-addproj-btn:hover,
html[data-theme="dark"] .office-dock-add:hover {
  background: var(--b-accent-h) !important;
  border-color: var(--b-accent-h) !important;
  color: #FFFFFF !important;
}

html[data-theme="dark"] .btn.success:hover,
html[data-theme="dark"] .run2 [data-run-submit]:hover {
  background: var(--b-success-h) !important;
  border-color: var(--b-success-h) !important;
  color: #FFFFFF !important;
}

html[data-theme="dark"] .btn.danger,
html[data-theme="dark"] .btn.pk.danger,
html[data-theme="dark"] .vecm-act.danger,
html[data-theme="dark"] .kb-op.danger,
html[data-theme="dark"] .kb-fopb.danger {
  background: var(--b-danger) !important;
  border-color: var(--b-danger) !important;
  color: #FFFFFF !important;
}

html[data-theme="dark"] .btn.accent,
html[data-theme="dark"] .office-addproj-btn,
html[data-theme="dark"] .office-dock-add {
  background: var(--b-accent) !important;
  border-color: var(--b-accent) !important;
  color: #FFFFFF !important;
}

html[data-theme="dark"] .btn.success,
html[data-theme="dark"] .run2 [data-run-submit] {
  background: var(--b-success) !important;
  border-color: var(--b-success) !important;
  color: #FFFFFF !important;
}

html[data-theme="dark"] .linkbtn,
html[data-theme="dark"] .lp2-lnk,
html[data-theme="dark"] .bug-open-btn,
html[data-theme="dark"] .office-histbtn,
html[data-theme="dark"] .text-link {
  background: none !important;
  border-color: transparent !important;
  color: #60A5FA !important;
}

@media (max-width: 640px) {
  .btn,
  .m-btn,
  .cd-btn,
  .vfd-btn,
  .kb-fmore-btn,
  .osm-fbtn,
  .osm-btn-sm {
    height: 36px !important;
    min-height: 36px !important;
  }

  .btn.sm,
  .btn.small,
  .m-btn-xs,
  .bug-ops-btn,
  .office-wk-btn,
  .kb-fmore-btn,
  .osm-fbtn,
  .osm-btn-sm {
    height: 30px !important;
    min-height: 30px !important;
  }

  .btn.icon,
  .iconbtn,
  .icon-btn {
    width: 32px !important;
    min-width: 32px !important;
    height: 32px !important;
    min-height: 32px !important;
  }
}

