/**
 * 矩阵全站顶栏 — 浅色通栏（启源AI·矩阵门户 / 深度洞察 / 矩阵慧眼 / … | 看板 | 语言）
 * 依赖 body.qy-matrix-light-header
 */
#qy-deep-insights {
  scroll-margin-top: 60px;
}
#qy-matrix-topbar .qy-matrix-brand--logo {
  display: inline-flex;
  align-items: center;
  max-height: 52px;
  padding: 4px 0;
}
#qy-matrix-topbar .qy-matrix-brand-logo {
  display: block;
  max-height: 34px;
  width: auto;
  object-fit: contain;
}
#qy-matrix-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100000;
  /* 与内联兜底一致；无 !important 时仍尽量浅 */
  background: rgba(254, 254, 255, 0.99);
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 2px 18px rgba(15, 23, 42, 0.07);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}
#qy-matrix-topbar .qy-matrix-topbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 16px;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
}
#qy-matrix-topbar .qy-matrix-brand {
  font-weight: 800;
  font-size: 0.95rem;
  color: #5b21b6;
  text-decoration: none;
  white-space: nowrap;
  margin-right: 8px;
}
#qy-matrix-topbar .qy-matrix-nav,
#qy-matrix-topbar nav.qy-matrix-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  flex: 1;
  min-width: 0;
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none !important;
}
#qy-matrix-topbar .qy-matrix-nav a {
  color: #0f172a;
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
}
#qy-matrix-topbar .qy-matrix-nav a:hover {
  color: #5b21b6;
  background: #f5f3ff;
}
#qy-matrix-topbar .qy-matrix-spacer {
  flex: 1;
  min-width: 8px;
}
#qy-matrix-topbar .qy-matrix-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
#qy-matrix-topbar .qy-matrix-login-slot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
#qy-matrix-topbar .qy-matrix-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 0.8125rem;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #5b21b6;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#qy-matrix-topbar .qy-matrix-login:hover {
  border-color: #c4b5fd;
  background: #faf5ff;
}
#qy-matrix-topbar .qy-matrix-login--user {
  border-color: #ddd6fe;
}
#qy-matrix-topbar .qy-matrix-register {
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  text-decoration: none;
  padding: 4px 2px;
}
#qy-matrix-topbar .qy-matrix-register:hover {
  color: #5b21b6;
  text-decoration: underline;
}
#qy-matrix-topbar #qy-matrix-kanban {
  box-sizing: border-box;
  min-height: 34px;
  padding: 0 16px;
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.8125rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.35);
}
#qy-matrix-topbar #qy-matrix-kanban:hover {
  filter: brightness(1.05);
}
#qy-matrix-topbar .qy-matrix-lang {
  position: relative;
}
#qy-matrix-topbar .qy-matrix-lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 34px;
  gap: 5px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #6d28d9;
  cursor: pointer;
  line-height: 1;
}
#qy-matrix-topbar .qy-matrix-lang-btn:hover {
  border-color: #c4b5fd;
}
#qy-matrix-topbar .qy-matrix-lang-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 200px;
  max-height: 320px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
  list-style: none;
  margin: 0;
  padding: 6px 0;
  display: none;
  z-index: 2;
}
#qy-matrix-topbar .qy-matrix-lang-menu.open {
  display: block;
}
#qy-matrix-topbar .qy-matrix-lang-menu li {
  padding: 9px 16px;
  font-size: 0.84rem;
  color: #334155;
  cursor: pointer;
}
#qy-matrix-topbar .qy-matrix-lang-menu li:hover {
  background: #f8fafc;
}
#qy-matrix-topbar .qy-matrix-lang-menu li.active {
  color: #7c3aed;
  font-weight: 700;
}

/* 矩阵浅色站：前台隐藏 WP 管理顶栏，避免出现一条黑色窄条并把矩阵顶栏整体下推 */
body.qy-matrix-light-header #wpadminbar {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
}
html.admin-bar:has(body.qy-matrix-light-header) {
  margin-top: 0 !important;
}
html.admin-bar body.qy-matrix-light-header {
  margin-top: 0 !important;
}
body.qy-matrix-light-header.admin-bar #qy-matrix-topbar {
  top: 0 !important;
}
/* ── 浅色全站底：压过 ai-creator matrix-skin（:root 深色变量）与主题包裹层 ── */
html:where(:has(body.qy-matrix-light-header)) {
  background: #f1f5f9;
}
body.qy-matrix-light-header {
  padding-top: 52px !important;
  /* 极淡紫灰渐变，与顶栏紫系一致 */
  background: linear-gradient(165deg, #fafbfc 0%, #f1f5f9 42%, #eef2ff 100%) fixed !important;
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
  -webkit-font-smoothing: antialiased;
}
/* matrix-theme.css 在 body.matrix-skin 上使用 var(--matrix-bg)；在 body 上重写变量，子树卡片等一并变浅 */
body.qy-matrix-light-header.matrix-skin {
  --matrix-bg: #f1f5f9;
  --matrix-surface: #ffffff;
  --matrix-surface-2: #f8fafc;
  --matrix-border: #e2e8f0;
  --matrix-text: #0f172a;
  --matrix-text-dim: #64748b;
  --matrix-geek-black: #0f172a;
  --matrix-accent: #7c3aed;
  --matrix-accent-hover: #6d28d9;
  --matrix-evidence-purple: #7c3aed;
  --matrix-accent-soft: rgba(124, 58, 237, 0.12);
}
/* GeneratePress / 常见主题：去掉大块深色包裹 */
body.qy-matrix-light-header #page,
body.qy-matrix-light-header .site,
body.qy-matrix-light-header .site.grid-container,
body.qy-matrix-light-header .site-content,
body.qy-matrix-light-header #content,
body.qy-matrix-light-header .content-area,
body.qy-matrix-light-header #primary,
body.qy-matrix-light-header .inside-article,
body.qy-matrix-light-header .separate-containers .inside-article,
body.qy-matrix-light-header .one-container .site-content,
body.qy-matrix-light-header .ast-plain-container,
body.qy-matrix-light-header .ast-separate-container .ast-article-post,
body.qy-matrix-light-header .ast-separate-container .ast-article-single {
  background-color: transparent !important;
  background-image: none !important;
  color: inherit;
}
/* 主题自带顶栏整块隐藏（矩阵顶栏已承担导航） */
body.qy-matrix-light-header #masthead.site-header,
body.qy-matrix-light-header #site-header,
body.qy-matrix-light-header header.site-header:not(#qy-matrix-topbar),
body.qy-matrix-light-header .site-header.grid-container:not(#qy-matrix-topbar),
body.qy-matrix-light-header .site-header,
body.qy-matrix-light-header .site-header .main-header,
body.qy-matrix-light-header .ast-primary-header-bar,
body.qy-matrix-light-header .site-branding {
  display: none !important;
}
body.qy-matrix-light-header .entry-content,
body.qy-matrix-light-header .entry-summary,
body.qy-matrix-light-header .ast-comment-content {
  color: #334155 !important;
}
/* 已登录 WP 时不再叠加 admin bar 高度，仅保留矩阵顶栏 52px（见上 body padding-top） */

/* www 首页含 #qy-toolify-root：去掉主题重复顶栏 / 正文标题区，布局接近 Toolify 单顶栏 */
body.qy-matrix-light-header:has(#qy-toolify-root) #masthead.site-header,
body.qy-matrix-light-header:has(#qy-toolify-root) .site-header:not(#qy-matrix-topbar),
body.qy-matrix-light-header:has(#qy-toolify-root) .site-header.grid-container {
  display: none !important;
}
body.qy-matrix-light-header:has(#qy-toolify-root) .site-main article .entry-header,
body.qy-matrix-light-header:has(#qy-toolify-root) .page-header,
body.qy-matrix-light-header:has(#qy-toolify-root) .inside-page-header {
  display: none !important;
}
body.qy-matrix-light-header:has(#qy-toolify-root) .entry-content > .wp-block-heading:empty,
body.qy-matrix-light-header:has(#qy-toolify-root) .entry-content > p:empty {
  display: none !important;
}
body.qy-matrix-light-header:has(#qy-toolify-root) .site.grid-container {
  padding-top: 0 !important;
}

/*
 * www 首页 #qy-toolify-root（Toolify 门户）：
 * aimc_galaxy_css 在 wp_head 优先 5 输出，早于主题；主题/FSE 常把 .entry-content 做成窄读版或 flex 纵排，
 * 会压扁三栏 grid、把搜索条拆成上下两行。此处用 !important 在矩阵样式表中强制「全宽 + 真三栏 + 横向搜索」。
 */
body.qy-matrix-light-header:has(#qy-toolify-root) .site.grid-container,
body.qy-matrix-light-header:has(#qy-toolify-root) .site-content,
body.qy-matrix-light-header:has(#qy-toolify-root) #primary,
body.qy-matrix-light-header:has(#qy-toolify-root) .content-area,
body.qy-matrix-light-header:has(#qy-toolify-root) .inside-article,
body.qy-matrix-light-header:has(#qy-toolify-root) article,
body.qy-matrix-light-header:has(#qy-toolify-root) .entry-content,
body.qy-matrix-light-header:has(#qy-toolify-root) .wp-block-post-content {
  max-width: none !important;
  width: 100% !important;
  box-sizing: border-box !important;
}
body.qy-matrix-light-header:has(#qy-toolify-root) .entry-content,
body.qy-matrix-light-header:has(#qy-toolify-root) .wp-block-post-content {
  display: block !important;
  align-items: stretch !important;
}
body.qy-matrix-light-header:has(#qy-toolify-root) .wp-block-html {
  max-width: none !important;
  width: 100% !important;
}
body.qy-matrix-light-header:has(#qy-toolify-root) .wp-block-group.is-layout-constrained:has(#qy-toolify-root),
body.qy-matrix-light-header:has(#qy-toolify-root) .is-layout-constrained:has(#qy-toolify-root) {
  max-width: none !important;
  width: 100% !important;
}
#qy-toolify-root.qy-portal-outer {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  box-sizing: border-box !important;
}
#qy-toolify-root .qy-portal-inner {
  width: 100% !important;
  max-width: 1360px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  box-sizing: border-box !important;
}
#qy-toolify-root .qy-portal-grid {
  display: grid !important;
  width: 100% !important;
  box-sizing: border-box !important;
  grid-template-columns: minmax(268px, 30%) minmax(0, 1fr) minmax(248px, 26%) !important;
  gap: 24px 28px !important;
  align-items: start !important;
}
@media (max-width: 1024px) {
  #qy-toolify-root .qy-portal-grid {
    grid-template-columns: 1fr !important;
  }
}
#qy-toolify-root .qy-portal-search {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  max-width: 800px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}
#qy-toolify-root .qy-portal-search input {
  flex: 1 1 auto !important;
  min-width: 0 !important;
}
#qy-toolify-root .qy-portal-search button {
  flex: 0 0 auto !important;
}

#qy-toolify-root .qy-feed-list.qy-feed-list--nav-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 12px !important;
  flex-direction: initial !important;
}
#qy-toolify-root .qy-feed-list.qy-feed-list--nav-grid .qy-feed-item {
  margin: 0 !important;
}
#qy-toolify-root .qy-feed-list.qy-feed-list--nav-grid .qy-feed-item .desc {
  -webkit-line-clamp: 3 !important;
}
#qy-toolify-root .qy-feed-more {
  grid-column: 1 / -1 !important;
  text-align: center !important;
  margin: 4px 0 0 !important;
  font-size: 0.86rem !important;
}
#qy-toolify-root .qy-feed-more a {
  color: #5b21b6 !important;
  font-weight: 600 !important;
  text-decoration: none !important;
}
@media (max-width: 720px) {
  #qy-toolify-root .qy-feed-list.qy-feed-list--nav-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ── Toolify 门户 v8：v7 + 门户内导航双列 feed / 与 deploy 页内 CSS 对齐 ── */
body.qy-matrix-light-header #qy-toolify-root .qy-portal-hero {
  position: relative !important;
  overflow: hidden !important;
  isolation: isolate !important;
}
body.qy-matrix-light-header #qy-toolify-root .qy-portal-hero-deco {
  pointer-events: none !important;
  z-index: 0 !important;
}
body.qy-matrix-light-header #qy-toolify-root .qy-portal-grid {
  float: none !important;
  clear: both !important;
  isolation: isolate !important;
}
body.qy-matrix-light-header #qy-toolify-root #qy-col-left,
body.qy-matrix-light-header #qy-toolify-root #qy-col-center,
body.qy-matrix-light-header #qy-toolify-root #qy-col-right {
  float: none !important;
  clear: none !important;
  position: relative !important;
  min-width: 0 !important;
  max-width: none !important;
  width: auto !important;
}
body.qy-matrix-light-header #qy-toolify-root #qy-col-left,
body.qy-matrix-light-header #qy-toolify-root #qy-col-right {
  overflow-x: hidden !important;
}
body.qy-matrix-light-header #qy-toolify-root .qy-feed-list.qy-feed-list--nav-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 12px !important;
}
@media (max-width: 720px) {
  body.qy-matrix-light-header #qy-toolify-root .qy-feed-list.qy-feed-list--nav-grid {
    grid-template-columns: 1fr !important;
  }
}
body.qy-matrix-light-header #qy-toolify-root .qy-feed-item {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  position: relative !important;
  float: none !important;
  clear: both !important;
  background: #fff !important;
  border: 1px solid #ececf2 !important;
  border-radius: 20px !important;
  margin: 0 !important;
}
body.qy-matrix-light-header #qy-toolify-root .qy-feed-item img {
  position: static !important;
  float: none !important;
  flex-shrink: 0 !important;
  display: block !important;
}
body.qy-matrix-light-header #qy-toolify-root .qy-side-card {
  display: flex !important;
  flex-direction: row !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  float: none !important;
  position: relative !important;
  background: #fff !important;
  border: 1px solid #ececf2 !important;
}
body.qy-matrix-light-header #qy-toolify-root .qy-tab,
body.qy-matrix-light-header #qy-toolify-root .qy-top10-pill {
  width: auto !important;
  max-width: 100% !important;
  display: inline-flex !important;
  flex: 0 0 auto !important;
  float: none !important;
  box-sizing: border-box !important;
}
body.qy-matrix-light-header #qy-toolify-root .qy-tab {
  background: transparent !important;
  color: #64748b !important;
}
body.qy-matrix-light-header #qy-toolify-root .qy-tab.active {
  background: linear-gradient(135deg, #ede9fe, #f5f3ff) !important;
  color: #5b21b6 !important;
  border: none !important;
}
body.qy-matrix-light-header #qy-toolify-root .qy-top10-pill {
  background: #fafaff !important;
  color: #334155 !important;
}
body.qy-matrix-light-header #qy-toolify-root .qy-portal-news-btn {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  float: none !important;
  background: #f8fafc !important;
  color: #5b21b6 !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 12px !important;
  padding: 10px 12px !important;
  margin: 0 0 6px !important;
  text-align: left !important;
  font: inherit !important;
  line-height: 1.45 !important;
  cursor: pointer !important;
}
body.qy-matrix-light-header #qy-toolify-root .qy-news-box .qy-news-btn {
  background: none !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
  width: 100% !important;
  text-align: left !important;
  color: #5b21b6 !important;
  font-weight: 600 !important;
  font-size: 0.82rem !important;
}
body.qy-matrix-light-header #qy-toolify-root .qy-modal-btn,
body.qy-matrix-light-header #qy-toolify-root .qy-portal-search button {
  width: auto !important;
  max-width: none !important;
  display: inline-flex !important;
  float: none !important;
}

/* ── /login/、/register/ 专页：与首页 Toolify 单顶栏一致，去掉矩阵条 + 主题头 ── */
body.qy-matrix-light-header:has(.qy-login-page-wrap) #qy-matrix-topbar,
body.qy-matrix-light-header:has(.qy-register-page-wrap) #qy-matrix-topbar {
  display: none !important;
}
body.qy-matrix-light-header:has(.qy-login-page-wrap) #masthead.site-header,
body.qy-matrix-light-header:has(.qy-login-page-wrap) #site-header,
body.qy-matrix-light-header:has(.qy-login-page-wrap) .site-header:not(#qy-matrix-topbar),
body.qy-matrix-light-header:has(.qy-login-page-wrap) .site-header.grid-container,
body.qy-matrix-light-header:has(.qy-login-page-wrap) .ast-above-header-wrap,
body.qy-matrix-light-header:has(.qy-login-page-wrap) .ast-custom-header,
body.qy-matrix-light-header:has(.qy-login-page-wrap) .elementor-location-header,
body.qy-matrix-light-header:has(.qy-register-page-wrap) #masthead.site-header,
body.qy-matrix-light-header:has(.qy-register-page-wrap) #site-header,
body.qy-matrix-light-header:has(.qy-register-page-wrap) .site-header:not(#qy-matrix-topbar),
body.qy-matrix-light-header:has(.qy-register-page-wrap) .site-header.grid-container,
body.qy-matrix-light-header:has(.qy-register-page-wrap) .ast-above-header-wrap,
body.qy-matrix-light-header:has(.qy-register-page-wrap) .ast-custom-header,
body.qy-matrix-light-header:has(.qy-register-page-wrap) .elementor-location-header {
  display: none !important;
}
body.qy-matrix-light-header:has(.qy-login-page-wrap) .site-main article .entry-header,
body.qy-matrix-light-header:has(.qy-login-page-wrap) .page-header,
body.qy-matrix-light-header:has(.qy-login-page-wrap) .inside-page-header,
body.qy-matrix-light-header:has(.qy-login-page-wrap) .entry-header,
body.qy-matrix-light-header:has(.qy-login-page-wrap) header.entry-header,
body.qy-matrix-light-header:has(.qy-register-page-wrap) .site-main article .entry-header,
body.qy-matrix-light-header:has(.qy-register-page-wrap) .page-header,
body.qy-matrix-light-header:has(.qy-register-page-wrap) .inside-page-header,
body.qy-matrix-light-header:has(.qy-register-page-wrap) .entry-header,
body.qy-matrix-light-header:has(.qy-register-page-wrap) header.entry-header {
  display: none !important;
}
body.qy-matrix-light-header:has(.qy-login-page-wrap),
body.qy-matrix-light-header:has(.qy-register-page-wrap) {
  padding-top: 0 !important;
  overflow-x: hidden !important;
  background: linear-gradient(180deg, #fafbfc 0%, #f1f5f9 45%, #eef2ff 100%) fixed !important;
  background-color: #f4f4f8 !important;
  color: #0f172a !important;
}
html:where(:has(body.qy-matrix-light-header):has(.qy-login-page-wrap)),
html:where(:has(body.qy-matrix-light-header):has(.qy-register-page-wrap)) {
  background: #f4f4f8;
  overflow-x: hidden;
}
body.qy-matrix-light-header:has(.qy-login-page-wrap) .site.grid-container,
body.qy-matrix-light-header:has(.qy-login-page-wrap) .site-content,
body.qy-matrix-light-header:has(.qy-login-page-wrap) #primary,
body.qy-matrix-light-header:has(.qy-register-page-wrap) .site.grid-container,
body.qy-matrix-light-header:has(.qy-register-page-wrap) .site-content,
body.qy-matrix-light-header:has(.qy-register-page-wrap) #primary {
  padding-top: 0 !important;
  max-width: none !important;
  width: 100% !important;
  box-sizing: border-box;
}
/* ai-matrix-style 右上角「登录|注册」条：与矩阵顶栏重复，整站隐藏 */
body.qy-matrix-light-header #qiyuan-sso-bar {
  display: none !important;
}

/*
 * FSE 顶栏窄条：仅作用于 header 模板，勿写全局 .wp-block-group…
 * （正文/侧栏外层也常带 has-global-padding + is-layout-constrained，全局隐藏会导致整页空白）
 */
body.qy-matrix-light-header:has(.qy-nav) .wp-site-blocks > header .wp-block-group.has-global-padding.is-layout-constrained,
body.qy-matrix-light-header:has(.qy-nav) header.wp-block-template-part .wp-block-group.has-global-padding.is-layout-constrained {
  display: none !important;
}

/*
 * FSE main 外包层：theme.json 的 spacing 常以内联形式出现在
 * div.wp-block-group.alignfull.has-global-padding（如 padding-top: var(--wp--preset--spacing--80)），
 * 造成通栏下整片「空层」。必须用 !important 盖掉内联，不能只改 #primary。
 */
body.qy-matrix-light-header:has(.qy-nav) main .wp-block-group.alignfull.has-global-padding,
body.qy-matrix-light-header:has(.qy-nav) main > .wp-block-group.has-global-padding.is-layout-constrained,
body.qy-matrix-light-header:has(.qy-nav) main > .wp-block-group.has-global-padding.wp-block-group-is-layout-flow,
body.qy-matrix-light-header:has(.qy-nav) .wp-site-blocks > main > .wp-block-group.has-global-padding {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  padding-block: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* 保险：含 .qy-nav 的 Group 不可被误隐藏，且去掉 theme 大内边距 */
body.qy-matrix-light-header:has(.qy-nav) .wp-block-group:has(.qy-nav) {
  display: block !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  padding-block: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* ── Nav 首页 .qy-nav：去掉主题黑条/重复站点标题、去掉大 Hero，浅色高密网格（参考 toolify 列表密度）── */
body.qy-matrix-light-header:has(.qy-nav) .wp-block-site-title,
body.qy-matrix-light-header:has(.qy-nav) .wp-block-post-title,
body.qy-matrix-light-header:has(.qy-nav) .entry-title,
body.qy-matrix-light-header:has(.qy-nav) .site-main .entry-header,
body.qy-matrix-light-header:has(.qy-nav) .page-header,
body.qy-matrix-light-header:has(.qy-nav) .inside-page-header,
body.qy-matrix-light-header:has(.qy-nav) header.entry-header,
body.qy-matrix-light-header:has(.qy-nav) .ast-title-bar-wrap,
body.qy-matrix-light-header:has(.qy-nav) .ast-above-header-wrap,
body.qy-matrix-light-header:has(.qy-nav) .ast-custom-header,
body.qy-matrix-light-header:has(.qy-nav) .top-bar,
body.qy-matrix-light-header:has(.qy-nav) .gp-secondary-header,
body.qy-matrix-light-header:has(.qy-nav) #mobile-header {
  display: none !important;
}
body.qy-matrix-light-header:has(.qy-nav) .qy-nav-hero {
  display: none !important;
}
/* Nav：顶栏下第一屏与矩阵通栏「贴紧」，去掉主题/FSE 常见的大 padding-top */
body.qy-matrix-light-header:has(.qy-nav) .site-main,
body.qy-matrix-light-header:has(.qy-nav) #primary,
body.qy-matrix-light-header:has(.qy-nav) .content-area,
body.qy-matrix-light-header:has(.qy-nav) .site-content,
body.qy-matrix-light-header:has(.qy-nav) .inside-article,
body.qy-matrix-light-header:has(.qy-nav) article,
body.qy-matrix-light-header:has(.qy-nav) .entry-content,
body.qy-matrix-light-header:has(.qy-nav) .wp-block-post-content,
body.qy-matrix-light-header:has(.qy-nav) .wp-site-blocks > main,
body.qy-matrix-light-header:has(.qy-nav) .site.grid-container {
  padding-top: 0 !important;
  margin-top: 0 !important;
}

body.qy-matrix-light-header:has(.qy-nav) .qy-nav {
  max-width: 1240px;
  margin: 0 auto;
  padding: 4px 16px 32px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #0f172a;
  background: transparent !important;
}

/* Toolify 式矩阵 Hero + 搜索（由 global-matrix-header.js 注入 #qy-nav-matrix-hero） */
body.qy-matrix-light-header:has(.qy-nav) .qy-nav-matrix-hero {
  position: relative;
  text-align: center;
  padding: 14px 16px 14px;
  margin: 0 0 12px;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e8e8ef;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.05);
}
body.qy-matrix-light-header:has(.qy-nav) .qy-nmh-grid-bg {
  position: absolute;
  inset: 0;
  opacity: 0.5;
  background-image: linear-gradient(rgba(15, 23, 42, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.035) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
}
body.qy-matrix-light-header:has(.qy-nav) .qy-nmh-inner {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
}
body.qy-matrix-light-header:has(.qy-nav) .qy-nmh-tag {
  font-size: 0.75rem;
  color: #94a3b8;
  margin: 0 0 6px;
  letter-spacing: 0.03em;
}
body.qy-matrix-light-header:has(.qy-nav) .qy-nmh-h1 {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 0.12em 0.28em;
  font-size: clamp(1.45rem, 3.8vw, 2.1rem);
  font-weight: 900;
  line-height: 1.2;
  margin: 0 0 8px;
  color: #0f172a;
}
body.qy-matrix-light-header:has(.qy-nav) .qy-nmh-h1 .qy-nmh-grad {
  background: linear-gradient(105deg, #2563eb 0%, #6d28d9 48%, #db2777 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
body.qy-matrix-light-header:has(.qy-nav) .qy-nmh-stats {
  font-size: 0.86rem;
  color: #64748b;
  margin: 0 0 12px;
  line-height: 1.45;
}
body.qy-matrix-light-header:has(.qy-nav) .qy-nmh-stats .qy-nmh-num {
  color: #7c3aed;
  font-weight: 800;
}
body.qy-matrix-light-header:has(.qy-nav) .qy-nmh-search {
  display: flex;
  max-width: 640px;
  margin: 0 auto;
  border-radius: 999px;
  overflow: hidden;
  box-shadow: 0 6px 28px rgba(91, 33, 182, 0.12);
  border: 1px solid #e5e7eb;
  background: #fff;
}
body.qy-matrix-light-header:has(.qy-nav) .qy-nmh-search input[type="search"] {
  flex: 1;
  min-width: 0;
  border: none;
  padding: 11px 16px;
  font-size: 0.9rem;
  background: #ecfdf5;
  color: #0f172a;
  outline: none;
}
body.qy-matrix-light-header:has(.qy-nav) .qy-nmh-search input::placeholder {
  color: #94a3b8;
}
body.qy-matrix-light-header:has(.qy-nav) .qy-nmh-search button {
  border: none;
  padding: 0 18px;
  font-weight: 800;
  font-size: 0.9rem;
  background: linear-gradient(135deg, #7c3aed, #6366f1);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}
body.qy-matrix-light-header:has(.qy-nav) .qy-nmh-search button:hover {
  filter: brightness(1.06);
}
@media (max-width: 520px) {
  body.qy-matrix-light-header:has(.qy-nav) .qy-nmh-search {
    flex-direction: column;
    border-radius: 16px;
  }
  body.qy-matrix-light-header:has(.qy-nav) .qy-nmh-search button {
    padding: 12px 16px;
  }
}
body.qy-matrix-light-header:has(.qy-nav) .qy-nav-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
  margin: 0 0 10px;
}
body.qy-matrix-light-header:has(.qy-nav) .qy-nav-tag {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
body.qy-matrix-light-header:has(.qy-nav) .qy-nav-tag:hover,
body.qy-matrix-light-header:has(.qy-nav) .qy-nav-tag.active {
  border-color: #c4b5fd;
  background: #f5f3ff;
  color: #5b21b6;
}
body.qy-matrix-light-header:has(.qy-nav) .qy-bento {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)) !important;
  gap: 10px !important;
  margin: 0 0 28px !important;
}
body.qy-matrix-light-header:has(.qy-nav) .qy-bento-card {
  grid-column: auto !important;
  grid-row: auto !important;
  position: relative;
  display: block !important;
  padding: 12px 10px !important;
  border-radius: 12px !important;
  border: 1px solid #e5e7eb !important;
  background: #fff !important;
  color: #0f172a !important;
  text-decoration: none !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
}
body.qy-matrix-light-header:has(.qy-nav) .qy-bento-card:hover {
  border-color: #d8b4fe !important;
  box-shadow: 0 4px 14px rgba(91, 33, 182, 0.08) !important;
  transform: translateY(-1px);
}
body.qy-matrix-light-header:has(.qy-nav) .qy-bento-card::before {
  display: none !important;
}
body.qy-matrix-light-header:has(.qy-nav) .qy-bc-icon {
  width: 40px !important;
  height: 40px !important;
  margin-bottom: 8px !important;
  font-size: 1.35rem !important;
  border-radius: 10px !important;
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
}
body.qy-matrix-light-header:has(.qy-nav) .qy-bc-icon img {
  width: 28px !important;
  height: 28px !important;
}
body.qy-matrix-light-header:has(.qy-nav) .qy-bc-name {
  font-size: 0.875rem !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  margin-bottom: 4px !important;
}
body.qy-matrix-light-header:has(.qy-nav) .qy-bc-desc {
  font-size: 0.72rem !important;
  line-height: 1.45 !important;
  color: #64748b !important;
  margin-bottom: 0 !important;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
body.qy-matrix-light-header:has(.qy-nav) .qy-bc-badge {
  margin-top: 6px;
}
body.qy-matrix-light-header:has(.qy-nav) .qy-nav-cta {
  padding: 28px 0 8px;
  text-align: center;
}
body.qy-matrix-light-header:has(.qy-nav) .qy-nav-cta h2 {
  font-size: 1.1rem;
  color: #0f172a;
  margin: 0 0 8px;
}
body.qy-matrix-light-header:has(.qy-nav) .qy-nav-cta p {
  font-size: 0.875rem;
  color: #64748b;
  margin: 0 0 16px;
}
body.qy-matrix-light-header:has(.qy-nav) .qy-nav-cta a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 20px;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 700;
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: #fff !important;
  text-decoration: none !important;
}
@media (min-width: 1280px) {
  body.qy-matrix-light-header:has(.qy-nav) .qy-bento {
    grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)) !important;
  }
}

/*
 * ── 精选工具侧卡 & 导航 Feed 卡片：描述文字截断兜底 ──────────────────────────
 * 根因：.qy-side-card 为 flex 行布局，内层 <div>（无 class）缺少 min-width:0，
 * 导致 flex child 无法收缩至容器宽度，URL 类长词会撑破卡片。
 * 同时将侧卡描述固定为单行省略，让卡片高度整齐。
 */
body.qy-matrix-light-header #qy-toolify-root .qy-side-card > div {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  overflow: hidden !important;
}
body.qy-matrix-light-header #qy-toolify-root .qy-side-card .d {
  display: block !important;
  -webkit-line-clamp: unset !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
/* Feed 卡（Tab 导航热门双列网格）：描述固定 2 行，显式补全 -webkit-box 属性防主题覆盖 */
body.qy-matrix-light-header #qy-toolify-root .qy-feed-item .meta {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  overflow: hidden !important;
}
body.qy-matrix-light-header #qy-toolify-root .qy-feed-item .desc {
  display: -webkit-box !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  -webkit-line-clamp: 2 !important;
}

/* 隐藏主题主导航（保留顶栏由本插件注入）— 常见主题选择器 */
body.qy-matrix-light-header .site-header .main-navigation,
body.qy-matrix-light-header .site-header nav:not(.qy-matrix-nav),
body.qy-matrix-light-header #site-navigation:not(#qy-matrix-topbar *),
body.qy-matrix-light-header #primary-navigation,
body.qy-matrix-light-header .ast-primary-header-bar-navigation,
body.qy-matrix-light-header .ast-builder-menu,
body.qy-matrix-light-header .main-navigation .menu,
body.qy-matrix-light-header header .genesis-nav-menu,
body.qy-matrix-light-header .wp-block-navigation:not(#qy-matrix-topbar .wp-block-navigation) {
  display: none !important;
}
body.qy-matrix-light-header .menu-toggle,
body.qy-matrix-light-header .ast-mobile-menu-buttons {
  display: none !important;
}

/* 资产看板 Web Component 外框（Shadow 内浅色由 qiyuan-asset-dashboard.js 控制） */
body.qy-matrix-light-header qiyuan-asset-dashboard.qiyuan-asset-dashboard-root {
  display: block;
  margin-top: 1.25rem;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  box-shadow: 0 4px 22px rgba(15, 23, 42, 0.05);
}

/* ── 深度洞察（PHP 增加 body.qy-insights-channel；归档另有 category-insights）：浅色底强制压过 matrix-skin / galaxy / 主题 ── */
html:where(:has(body.qy-matrix-light-header.qy-insights-channel)),
html:where(:has(body.qy-matrix-light-header.category-insights)) {
  background-color: #f1f5f9 !important;
}
body.qy-matrix-light-header.qy-insights-channel.matrix-skin,
body.qy-matrix-light-header.category-insights.matrix-skin {
  --matrix-bg: #f1f5f9;
  --matrix-surface: #ffffff;
  --matrix-surface-2: #f8fafc;
  --matrix-border: #e2e8f0;
  --matrix-text: #0f172a;
  --matrix-text-dim: #64748b;
  --matrix-geek-black: #0f172a;
  --matrix-accent: #7c3aed;
  --matrix-accent-hover: #6d28d9;
}
/* 勿把 body 设透明：会透出下层深色；与全站矩阵顶栏底一致 */
body.qy-matrix-light-header.qy-insights-channel,
body.qy-matrix-light-header.category-insights {
  background: linear-gradient(165deg, #fafbfc 0%, #f1f5f9 42%, #eef2ff 100%) fixed !important;
  background-color: #f1f5f9 !important;
  color: #1e293b !important;
}
body.qy-matrix-light-header.qy-insights-channel #page,
body.qy-matrix-light-header.qy-insights-channel .site,
body.qy-matrix-light-header.category-insights #page,
body.qy-matrix-light-header.category-insights .site {
  background: transparent !important;
  background-color: transparent !important;
  color: inherit;
}
/* 主阅读列：居中 + 舒适行长 */
body.qy-matrix-light-header.qy-insights-channel #primary,
body.qy-matrix-light-header.qy-insights-channel .site-main {
  max-width: 720px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 20px !important;
  padding-right: 20px !important;
  float: none !important;
  width: 100% !important;
  box-sizing: border-box !important;
}
/* 阅读频道单列：隐藏侧栏避免斑马栅格与错位（GeneratePress 等） */
body.qy-matrix-light-header.qy-insights-channel #secondary,
body.qy-matrix-light-header.qy-insights-channel .widget-area.sidebar-widgets-outer-wrapper,
body.qy-matrix-light-header.qy-insights-channel aside.secondary {
  display: none !important;
}
body.qy-matrix-light-header.qy-insights-channel .ast-separate-container,
body.qy-matrix-light-header.qy-insights-channel .ast-separate-container .ast-row,
body.qy-matrix-light-header.qy-insights-channel .content-area,
body.qy-matrix-light-header.qy-insights-channel .site-content {
  background: transparent !important;
  background-image: none !important;
}
/* 分类页标题区：居中、柔和卡片 */
body.qy-matrix-light-header.qy-insights-channel.archive .page-header,
body.qy-matrix-light-header.qy-insights-channel.archive .ast-archive-title-wrap,
body.qy-matrix-light-header.qy-insights-channel.archive .ast-archive-description {
  text-align: center !important;
  max-width: 640px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}
body.qy-matrix-light-header.qy-insights-channel.archive .page-header,
body.qy-matrix-light-header.qy-insights-channel.archive .ast-archive-description {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 18px !important;
  padding: 1.35rem 1.5rem !important;
  margin-bottom: 1.5rem !important;
  color: #475569 !important;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06) !important;
}
body.qy-matrix-light-header.qy-insights-channel.archive .page-title,
body.qy-matrix-light-header.qy-insights-channel.archive .ast-archive-title,
body.qy-matrix-light-header.qy-insights-channel.archive h1 {
  color: #0f172a !important;
  font-weight: 800 !important;
}
/* 强制去掉归档斑马（奇偶 nth / 主题交替背景） */
body.qy-matrix-light-header.qy-insights-channel .site-main article,
body.qy-matrix-light-header.qy-insights-channel .site-main article:nth-child(odd),
body.qy-matrix-light-header.qy-insights-channel .site-main article:nth-child(even),
body.qy-matrix-light-header.qy-insights-channel .ast-separate-container .ast-article-post,
body.qy-matrix-light-header.qy-insights-channel .ast-separate-container .ast-article-inner,
body.qy-matrix-light-header.qy-insights-channel article.post,
body.qy-matrix-light-header.qy-insights-channel .ast-archive-post,
body.qy-matrix-light-header.qy-insights-channel .hentry {
  background: #ffffff !important;
  background-image: none !important;
  color: #1e293b !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 16px !important;
  box-shadow: 0 2px 16px rgba(15, 23, 42, 0.05) !important;
  margin-bottom: 14px !important;
  padding: 1.15rem 1.25rem !important;
}
body.qy-matrix-light-header.qy-insights-channel .entry-title,
body.qy-matrix-light-header.qy-insights-channel .entry-title a,
body.qy-matrix-light-header.qy-insights-channel h2.entry-title a {
  color: #0f172a !important;
}
body.qy-matrix-light-header.qy-insights-channel .entry-title a:hover {
  color: #5b21b6 !important;
}
body.qy-matrix-light-header.qy-insights-channel .entry-summary,
body.qy-matrix-light-header.qy-insights-channel .entry-content,
body.qy-matrix-light-header.qy-insights-channel .entry-meta {
  color: #64748b !important;
}
body.qy-matrix-light-header.qy-insights-channel .entry-meta a {
  color: #5b21b6 !important;
}
/* 区块主题列表 */
body.qy-matrix-light-header.qy-insights-channel .wp-block-post-template .wp-block-post,
body.qy-matrix-light-header.qy-insights-channel .wp-block-query .wp-block-post {
  background: #ffffff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 16px !important;
  padding: 1.15rem 1.25rem !important;
  margin-bottom: 14px !important;
  box-shadow: 0 2px 14px rgba(15, 23, 42, 0.05) !important;
  color: #1e293b !important;
}
body.qy-matrix-light-header.qy-insights-channel .wp-block-post-title a {
  color: #0f172a !important;
}
/* 分页 */
body.qy-matrix-light-header.qy-insights-channel .navigation.pagination,
body.qy-matrix-light-header.qy-insights-channel .ast-pagination {
  justify-content: center !important;
  margin-top: 1.5rem !important;
}
body.qy-matrix-light-header.qy-insights-channel .navigation.pagination a,
body.qy-matrix-light-header.qy-insights-channel .page-numbers {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  color: #5b21b6 !important;
  border-radius: 10px !important;
}
body.qy-matrix-light-header.qy-insights-channel .navigation.pagination a:hover,
body.qy-matrix-light-header.qy-insights-channel .page-numbers.current {
  background: #f5f3ff !important;
}
/* 单篇正文：居中卡片 + 舒适排版（含 https://www.../slug/ 洞察文） */
body.qy-matrix-light-header.qy-insights-channel.single .inside-article,
body.qy-matrix-light-header.qy-insights-channel.single article.post,
body.qy-matrix-light-header.qy-insights-channel.single .ast-separate-container .ast-article-single {
  background: #ffffff !important;
  color: #334155 !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 20px !important;
  box-shadow: 0 8px 40px rgba(15, 23, 42, 0.07) !important;
  padding: clamp(1.25rem, 3vw, 2rem) clamp(1.1rem, 2.5vw, 1.75rem) !important;
  max-width: 720px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}
body.qy-matrix-light-header.qy-insights-channel.single .entry-header {
  text-align: center !important;
  margin-bottom: 1.25rem !important;
  padding-bottom: 1rem !important;
  border-bottom: 1px solid #f1f5f9 !important;
}
body.qy-matrix-light-header.qy-insights-channel.single .entry-title {
  color: #0f172a !important;
  font-weight: 800 !important;
  line-height: 1.25 !important;
}
body.qy-matrix-light-header.qy-insights-channel.single .entry-content,
body.qy-matrix-light-header.qy-insights-channel.single .entry-content p,
body.qy-matrix-light-header.qy-insights-channel.single .entry-content li {
  color: #475569 !important;
  font-size: 1.02rem !important;
  line-height: 1.75 !important;
}
body.qy-matrix-light-header.qy-insights-channel.single .entry-content a {
  color: #5b21b6 !important;
  text-decoration: underline;
  text-underline-offset: 3px;
}
body.qy-matrix-light-header.qy-insights-channel.single .entry-content strong {
  color: #1e293b !important;
}
/* 评论区 */
body.qy-matrix-light-header.qy-insights-channel #comments,
body.qy-matrix-light-header.qy-insights-channel .comments-area {
  max-width: 720px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  background: #ffffff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 18px !important;
  padding: 1.25rem !important;
  margin-top: 2rem !important;
  color: #334155 !important;
}

/*
 * ── 精选工具侧卡 & 导航 Feed 图标：强制 40/44px，覆盖主题 height:auto !important ─
 * 根因：WP 主题往往注入 img { max-width:100%; height:auto !important }，导致图标按
 * 图片自然尺寸等比放大。用 body.qy-matrix-light-header + #qy-toolify-root 选择器
 * 提升优先级，并加 !important 完全覆盖主题。
 */
body.qy-matrix-light-header #qy-toolify-root .qy-side-card img {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  min-height: 40px !important;
  max-width: 40px !important;
  max-height: 40px !important;
  border-radius: 10px !important;
  object-fit: cover !important;
  flex-shrink: 0 !important;
  display: block !important;
}
body.qy-matrix-light-header #qy-toolify-root .qy-feed-item img {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  max-width: 44px !important;
  max-height: 44px !important;
  border-radius: 12px !important;
  object-fit: cover !important;
  flex-shrink: 0 !important;
  display: block !important;
}

/*
 * ── Portal 弹窗：body 级挂载样式 ─────────────────────────────────────────────
 * init JS 会把 #qy-portal-modal 从 #qy-toolify-root 移到 <body>，以绕过祖先
 * CSS（overflow/isolation 等）对 position:fixed 的破坏。移出后原 #qy-toolify-root
 * 选择器不再匹配，此处补全所有必要样式。
 */
body > .qy-portal-modal {
  position: fixed !important;
  inset: 0;
  z-index: 999999 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}
body > .qy-portal-modal[hidden] { display: none !important; }
body > .qy-portal-modal .qy-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  backdrop-filter: blur(4px);
}
body > .qy-portal-modal .qy-modal-panel {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-height: min(86vh, 640px);
  overflow-y: auto;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, .2);
  padding: 22px 22px 18px;
  border: 1px solid #e8e8ef;
}
body > .qy-portal-modal .qy-modal-x {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
body > .qy-portal-modal .qy-modal-x:hover { background: #e2e8f0; color: #0f172a; }
body > .qy-portal-modal .qy-modal-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 12px;
  padding-right: 28px;
}
body > .qy-portal-modal .qy-modal-head img {
  width: 56px !important;
  height: 56px !important;
  min-width: 56px !important;
  border-radius: 14px !important;
  object-fit: cover !important;
  flex-shrink: 0 !important;
  background: #f1f5f9;
}
body > .qy-portal-modal .qy-modal-head h3 { margin: 0; font-size: 1.15rem; font-weight: 800; color: #0f172a; line-height: 1.25; }
body > .qy-portal-modal .qy-modal-head p  { margin: 4px 0 0; font-size: .8rem; color: #64748b; }
body > .qy-portal-modal .qy-modal-desc { font-size: .9rem; color: #475569; line-height: 1.55; margin: 0 0 18px; white-space: pre-wrap; }
body > .qy-portal-modal .qy-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}
body > .qy-portal-modal .qy-modal-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
}
body > .qy-portal-modal .qy-modal-btn.secondary { background: #f1f5f9; color: #334155; border-color: #e2e8f0; }
body > .qy-portal-modal .qy-modal-btn.primary   { background: linear-gradient(135deg,#7c3aed,#5b21b6); color: #fff; }
body > .qy-portal-modal .qy-modal-btn.tertiary  { background: linear-gradient(135deg,#059669,#047857); color: #fff; }
body > .qy-portal-modal .qy-modal-btn:disabled  { opacity: .55; cursor: not-allowed; }
