/* align_polish_v1.css — gugu8858.icu 全站对齐规整一致性修复
   审计方法: Playwright + Chrome 程序化遍历 13 个页面, 检测同行 y 差>3px /
   同列 x 不齐 / 行内高度差>4px / 间距不均, 聚焦表格行、表单行、按钮组、
   卡片网格、顶部状态栏、侧栏菜单。
   修复范围: 仅对齐相关属性 (align-items / vertical-align / line-height /
   gap / justify-content / margin ≤4px), 不改宽高, 不引入「全部下移」。 */

/* ============================================================
   1. 顶部状态栏 — header.rc-header 叶子元素垂直偏移 7px
      实测: 文本节点 lh 16.8px (y≈19.1) 与图标/控件 32px 行高不齐。
      修复: 顶栏 flex 子容器 align-items:center, 内部 svg/span 转 inline-flex
      并统一 line-height:1, 使所有叶子以 56px 顶栏中线 (y=28) 居中。
   ============================================================ */
html body:has(.brand-lockup) .ant-layout-header > div {
  align-items: center !important;
}

/* 顶栏时钟 / 汇率 / 表情图标等裸 span: 转 inline-flex 自身居中, 统一 24px 字盒 */
html body:has(.brand-lockup) .ant-layout-header > div > span:not([class*="ant-tag"]) {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 24px !important;
  line-height: 1 !important;
  vertical-align: middle !important;
}

/* 顶栏内 svg 图标: 与相邻文字同线 (原 baseline 对齐导致 21.5 vs 19.1 错开) */
html body:has(.brand-lockup) .ant-layout-header svg {
  vertical-align: middle !important;
}

/* 顶栏叶子文字行高归一 (顶栏内部由 flex 居中, 行高只影响字盒内部) */
html body:has(.brand-lockup) .ant-layout-header > div .ant-space-item {
  line-height: 1.5 !important;
}

/* ============================================================
   2. 用户区按钮组 — .ant-space 行内高度差 4.1px
      实测: 头像 item h=24, 用户名 item h=19.9 (内层 span h=16, 块级盒子
      仍按 lh 19.6 算但基线漂移), tag item h=24。三个 item 中线不齐。
      修复: 顶栏内 .ant-space-item 转 inline-flex + align-items:center,
      内容行高归一, 三个 item 以同一中线对齐。
   ============================================================ */
html body:has(.brand-lockup) .ant-layout-header .ant-space {
  align-items: center !important;
}
html body:has(.brand-lockup) .ant-layout-header .ant-space .ant-space-item {
  display: inline-flex !important;
  align-items: center !important;
  height: 24px !important;
  line-height: 1 !important;
}
html body:has(.brand-lockup) .ant-layout-header .ant-space .ant-space-item > span {
  display: inline-flex !important;
  align-items: center !important;
  line-height: 1 !important;
}

/* ============================================================
   3. 侧栏菜单 — 图标与文字垂直中心不齐
      实测: .ant-menu-item-icon (14px svg) 用 vertical-align:-1.75px 对齐
      lh=40px 的文字, 在部分主题字重下中心漂移 1~2px; 子菜单展开时
      子项行高 (30px) 与父项 (40px) 不一致。
      修复: 菜单项/子菜单标题已是 flex, 统一 align-items:center;
      icon 转 inline-flex 居中, title-content 行高继承; 子菜单子项
      行高与高度一致 (30px), 保持菜单节奏统一。
   ============================================================ */
html body:has(.brand-lockup) .ant-menu .ant-menu-item,
html body:has(.brand-lockup) .ant-menu .ant-menu-submenu-title {
  align-items: center !important;
}
html body:has(.brand-lockup) .ant-menu .ant-menu-item-icon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  vertical-align: middle !important;
  line-height: 1 !important;
  margin-top: -1px !important;
}
html body:has(.brand-lockup) .ant-menu .ant-menu-title-content {
  display: inline-block !important;
  vertical-align: middle !important;
  line-height: inherit !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  white-space: nowrap !important;
}

/* 子菜单展开后的子项: 行高与自身高度一致, 与父项节奏对齐 */
html body:has(.brand-lockup) .ant-menu-sub .ant-menu-item {
  display: flex !important;
  align-items: center !important;
  line-height: inherit !important;
}
html body:has(.brand-lockup) .ant-menu-sub .ant-menu-item .ant-menu-title-content {
  line-height: 30px !important;
  height: auto !important;
  min-height: 20px !important;
}

/* ============================================================
   4. 通用按钮组 — 同排按钮/控件行内高度差 ≤4px 收敛
      实测: 工具栏 .ant-space 内按钮与输入框混排时偶有 4.1px 高差。
      修复: 工具栏/操作条内 .ant-space 强制 align-items:center,
      行内控件 vertical-align 归一。
   ============================================================ */
html body:has(.brand-lockup) .ant-space {
  align-items: center !important;
}
html body:has(.brand-lockup) .ant-btn,
html body:has(.brand-lockup) .ant-input-affix-wrapper,
html body:has(.brand-lockup) .ant-select-selector,
html body:has(.brand-lockup) .ant-input-number {
  vertical-align: middle !important;
}

/* ============================================================
   5. 表格单元格 — 同行单元格中线对齐
      修复: td/th vertical-align:middle, 行内控件行高归一,
      避免操作列按钮与文字列基线错开。
   ============================================================ */
html body:has(.brand-lockup) .ant-table-tbody > tr > td,
html body:has(.brand-lockup) .ant-table-thead > tr > th {
  vertical-align: middle !important;
}
html body:has(.brand-lockup) .ant-table-tbody > tr > td .ant-btn,
html body:has(.brand-lockup) .ant-table-tbody > tr > td .ant-tag,
html body:has(.brand-lockup) .ant-table-tbody > tr > td .ant-switch {
  vertical-align: middle !important;
}
