/* ==========================================================================
   日日回款数据新鲜度告警条 · 降噪
   作用域：body > div[data-api-daily-freshness]:not([hidden])
   只影响首页与 /daily 在「数据过期/不可用」时的提示条，其他页面高度恒 0，不受影响。
   ========================================================================== */

/* --- 1. 条本身：从两行正文降为一条细提示 --------------------------------- */
body > div[data-api-daily-freshness]:not([hidden]) {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: baseline !important;
  gap: 0 8px !important;
  box-sizing: border-box !important;
  font-size: 11px !important;
  line-height: 1.6 !important;
  padding: 5px 12px !important;
  color: #5f6773 !important;
  background: #f4f6f8 !important;
  border-bottom: 1px solid #e3e7eb !important;
}

/* 状态句：占满剩余宽度，不换行挤压「核对明细」 */
body > div[data-api-daily-freshness] .fxv-head {
  flex: 1 1 auto !important;
  min-width: 0 !important;
}

/* --- 2. 核对明细：默认折叠 ------------------------------------------------ */
body > div[data-api-daily-freshness] details.fxv-more {
  flex: 0 0 auto !important;
}

body > div[data-api-daily-freshness] details.fxv-more > summary {
  cursor: pointer !important;
  color: #8a929c !important;
  font-size: 11px !important;
  line-height: 1.6 !important;
  list-style: none !important;
  user-select: none !important;
  white-space: nowrap !important;
}
body > div[data-api-daily-freshness] details.fxv-more > summary::-webkit-details-marker {
  display: none !important;
}
body > div[data-api-daily-freshness] details.fxv-more > summary::after {
  content: " ▾";
  font-size: 9px;
}
body > div[data-api-daily-freshness] details.fxv-more[open] > summary::after {
  content: " ▴";
}
body > div[data-api-daily-freshness] details.fxv-more > summary:hover {
  color: #4b5563 !important;
}

/* 展开时独占整行：否则 details 变宽会挤到下一行，位置跳动 */
body > div[data-api-daily-freshness] details.fxv-more[open] {
  flex-basis: 100% !important;
}

body > div[data-api-daily-freshness] details.fxv-more > .fxv-tail {
  display: block !important;
  flex-basis: 100% !important;
  margin-top: 3px !important;
  color: #7b838d !important;
  font-size: 11px !important;
  line-height: 1.6 !important;
}

/* --- 3. 收掉 main 的双重留白 ----
   告警条已经把固定顶栏（页头 50 + 页签栏 46 = 96）让开了，main 自己还有
   padding-top:96px（≥641）/ 64px（≤640），于是出现一大片空白。

   不能用覆盖 padding 的办法：既有的
   `body.aph2-theme:not(.aph-admin-page) main#main-content{padding-top:108px!important}`
   在 @layer 里，分层 !important 的优先级高于无层 !important —— 连 (1,3,4) 的
   选择器都压不动（实测五种写法全部无效）。而用 JS 写内联 !important 也不稳：
   React 重新渲染 main 时会清掉它。

   → 改用负外边距抵消：main 上移 (padding-top − 期望间距)，
     内容起点恒等于「告警条底部 + 16px」，告警条展开变高时自动跟随。
   ------------------------------------------------------------------------- */
body > div[data-api-daily-freshness]:not([hidden]) {
  margin-bottom: -80px !important; /* 96 - 16 */
  position: relative !important;
  z-index: 2 !important; /* 抬到 main 之上，避免重叠区吞掉「核对明细」的点击 */
}

@media (max-width: 640px) {
  body > div[data-api-daily-freshness]:not([hidden]) {
    margin-bottom: -52px !important; /* 64 - 12 */
  }
  /* 窄屏「核对明细」靠右，避免看起来像正文的续行 */
  body > div[data-api-daily-freshness] details.fxv-more:not([open]) {
    margin-left: auto !important;
  }
  body > div[data-api-daily-freshness] details.fxv-more[open] {
    margin-left: 0 !important;
  }
}

@media (max-width: 640px) {
  body > div[data-api-daily-freshness]:not([hidden]) {
    padding: 5px 12px !important;
  }
}
