/* ============================================================
   ForgeyAI 全站间距规范化（8px 体系）+ 顶/底菜单栏统一固定
   - 顶部 .mf-nav / 底部 #mnb：统一 56px、固定定位
   - 容器 padding-top 8px；卡片 padding-top/左右 8px；卡片间距 8px
   - 手机端(≤860px)：容器左右归零，页面级块满宽贴屏幕两边，带背景块去圆角
   - 内层统计卡/子tab保持现状（不做满宽）；含 admin 与 iframe 嵌入态
   ============================================================ */
:root{
  --fy-bar-h:56px;   /* 底部导航高度，保持不变 */
  --fy-nav-h:46px;   /* 顶部导航高度：56 → 46（减 10px） */
  --fy-gap:8px;
}

/* 有背景的页面级块（手机端去圆角、去左右边框） */
/* .card .panel .mf-sec .mode-switch .cm-tabs .fw-tabs .va-tabs .liqtabs
   .sk-panel .acc-card .up-card .login .sc-card .sr-item .qa .ov
   .tkcard .tablecard .as-card .side-card .tool-card .mkt-panel .mkt-tabs */
/* 无背景页面块/包装（手机端仅满宽、左右归零） */
/* .layout .sk-mode .swlayout .msub-tabs .mkt-filter .sc-head
   .page-head .backbar .hp-hero .sc-search .sr-hint .fw-title .cm-bar */
/* 内层统计卡（仅统一 padding，不做满宽） */
/* .kstat .sc-stat .rp-sum-card */

/* ===== ① 顶/底菜单栏：统一高度、固定位置 ===== */
.mf-nav{
  position:fixed!important;top:0;left:0;right:0;box-sizing:border-box!important;
  height:var(--fy-nav-h)!important;min-height:var(--fy-nav-h)!important;
  padding:0 16px!important;flex-wrap:nowrap!important;z-index:60;
}
#mnb{
  position:fixed!important;left:0;right:0;bottom:0;box-sizing:border-box!important;
  height:calc(var(--fy-bar-h) + env(safe-area-inset-bottom))!important;z-index:1100;
}
/* body 顶部留白：仅含 fixed 标准导航的页面留 46；sticky 自定义 header/无导航页不留 */
body:has(.mf-nav){padding-top:var(--fy-nav-h)!important}
body:not(:has(.mf-nav)){padding-top:0!important}
@media(max-width:860px){
  body:has(#mnb){padding-bottom:calc(var(--fy-bar-h) + env(safe-area-inset-bottom))!important}
  .mf-nav{padding:0 10px!important}
}
html.mf-embed body{padding-top:0!important;padding-bottom:0!important}
html.mf-embed #mnb{display:none!important}
html.mf-embed body:has(#mnb){padding-bottom:0!important}

/* ===== ② 容器：导航下沿 → 第一个页面块 = 8px ===== */
.wrap,.sk-wrap,.sc-wrap,.sr-wrap,.wp-wrap{padding-top:var(--fy-gap)!important}

/* body 直接子的子导航（swap/liquidity）：距导航 8、距后续容器 8 */
body>.msub-tabs{margin-top:var(--fy-gap)!important;margin-bottom:var(--fy-gap)!important}
body>.msub-tabs~.wrap{padding-top:0!important}

/* ===== ③ 全部卡片（含内层统计卡）：上/左/右内边距统一 8px，下内边距保持现状 ===== */
.card,.panel,.mf-sec,.mode-switch,.cm-tabs,.fw-tabs,.va-tabs,.liqtabs,
.sk-panel,.acc-card,.up-card,.login,.sc-card,.sr-item,.qa,.ov,
.tkcard,.tablecard,.as-card,.side-card,.tool-card,.mkt-panel,.mkt-tabs,
.kstat,.sc-stat,.rp-sum-card{
  padding-top:var(--fy-gap)!important;
  padding-left:var(--fy-gap)!important;
  padding-right:var(--fy-gap)!important;
}

/* ===== ④ 垂直间距：margin-bottom 8，末块归零 ===== */
.card,.panel,.mf-sec,.mode-switch,.cm-tabs,.fw-tabs,.va-tabs,.liqtabs,
.sk-panel,.acc-card,.up-card,.login,.sc-card,.sr-item,.qa,.ov,
.tkcard,.tablecard,.as-card,.side-card,.tool-card,.mkt-panel,.mkt-tabs,
.kstat,.sc-stat,.rp-sum-card{margin-bottom:var(--fy-gap)!important}
.card:last-child,.panel:last-child,.mf-sec:last-child,.mode-switch:last-child,
.cm-tabs:last-child,.fw-tabs:last-child,.va-tabs:last-child,.liqtabs:last-child,
.sk-panel:last-child,.acc-card:last-child,.up-card:last-child,.login:last-child,
.sc-card:last-child,.sr-item:last-child,.qa:last-child,.ov:last-child,
.tkcard:last-child,.tablecard:last-child,.as-card:last-child,
.side-card:last-child,.tool-card:last-child,.mkt-panel:last-child,
.mkt-tabs:last-child,.kstat:last-child,.sc-stat:last-child,
.rp-sum-card:last-child{margin-bottom:0!important}

/* grid/flex 容器自带 gap 时，子块不再叠加 margin-bottom，避免 8+8=16 */
.layout>.card,.layout>.panel,.layout>.mf-sec,.layout>.mode-switch,
.layout>.mkt-panel,.layout>.mkt-tabs{margin-bottom:0!important}

/* page-head 未建 BFC，h1 自带 margin-top 6px 会穿透叠加；归零并建立 BFC 防穿透 */
.page-head h1{margin-top:0!important}
.page-head{overflow:hidden!important}

/* 桌面端：market 无容器，filter 直接挂 body，补左右内边距避免贴边 */
.mkt-filter{padding-left:16px!important;padding-right:16px!important}

/* ============================================================
   ⑤ 手机端(≤860px)
   ============================================================ */
@media(max-width:860px){
  .wrap,.sk-wrap,.sc-wrap,.sr-wrap,.wp-wrap{padding-left:0!important;padding-right:0!important}

  /* 无背景页面块：满宽、上下外边距归零、左右归零 */
  .layout,.sk-mode,.swlayout,.mkt-filter,.sc-head,
  .page-head,.backbar,.hp-hero,.sc-search,.sr-hint,.fw-title,.cm-bar{
    box-sizing:border-box!important;
    margin-top:0!important;margin-left:0!important;margin-right:0!important;
    padding-left:0!important;padding-right:0!important;
    width:100%!important;max-width:100%!important;
  }
  /* launch 网格单列、间距 8 */
  .layout{grid-template-columns:1fr!important;gap:var(--fy-gap)!important}

  /* 有背景页面块：满宽、去圆角、去左右边框、上下外边距归零 */
  .card,.panel,.mf-sec,.mode-switch,.cm-tabs,.fw-tabs,.va-tabs,.liqtabs,.msub-tabs,
  .sk-panel,.acc-card,.up-card,.login,.sc-card,.sr-item,.qa,.ov,
  .tkcard,.tablecard,.as-card,.side-card,.tool-card,.mkt-panel,.mkt-tabs{
    box-sizing:border-box!important;
    border-radius:0!important;
    border-left:0!important;border-right:0!important;
    margin-top:0!important;margin-left:0!important;margin-right:0!important;
    width:100%!important;max-width:100%!important;
  }
  /* market 无容器：首块距导航 8、tab 按视口满宽 */
  .mkt-tabs{margin-top:var(--fy-gap)!important;width:100vw!important;max-width:100vw!important}

  /* diag 无固定顶栏：body 左右归零、顶部 8 */
  body.diag-page{padding:var(--fy-gap) 0!important}
}

/* ============================================================
   ⑥ 桌面端(>860px)：market 各块统一限宽 900 居中，左缘/宽度对齐
   ============================================================ */
@media(min-width:861px){
  .mkt-tabs,.mkt-filter{
    box-sizing:border-box!important;
    width:100%!important;max-width:900px!important;
    margin-left:auto!important;margin-right:auto!important;
    padding-left:8px!important;padding-right:8px!important;
  }
  /* 补偿面板 1px + 表格包裹 1px 边框，使控件外框对齐表格单元格外框 */
  .mkt-filter{padding-left:10px!important;padding-right:10px!important}
}
