/*
 * V36 content-aware summary tracks with uniform metric separators.
 * The summary belongs to the data surface instead of floating inside it.
 */

#app-shell #view .ad-metric-summary-head {
  width: 100%;
  min-height: 46px !important;
  height: auto !important;
  box-sizing: border-box;
  display: flex;
  align-items: center !important;
  justify-content: flex-start;
  gap: 12px !important;
  padding: 0 12px !important;
  overflow: visible;
  border-bottom: 1px solid var(--apple-table-line, rgba(60, 60, 67, 0.12));
  background: var(--apple-table-header-bg, rgba(255, 255, 255, 0.94)) !important;
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
}

#app-shell #view .ad-metric-summary-head::before,
#app-shell #view .ad-metric-summary-head::after {
  display: none;
  content: none;
}

/* Keep the grid stable if an older cached app bundle omits the count variable. */
#app-shell #view .ad-data-overview-summary-metrics,
#app-shell #view .automation-list-metrics {
  --ad-metric-count: 6;
}

#app-shell #view .ad-report-summary-cards {
  --ad-metric-count: 5;
}

#app-shell #view .ad-metric-strip {
  width: 100%;
  max-width: none;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 96px repeat(var(--ad-metric-count), minmax(86px, max-content)) minmax(0, 1fr);
  flex: 1 1 auto;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
  color: #1d1d1f;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#app-shell #view .ad-metric-strip::before {
  align-self: center;
  min-height: 28px;
  padding: 0 14px 0 4px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  content: "数据汇总";
  color: #1d1d1f;
  font-size: 12px;
  font-weight: 680;
  line-height: 1;
  letter-spacing: 0.01em;
  white-space: nowrap;
  border-right: 1px solid rgba(60, 60, 67, 0.12);
}

#app-shell #view .ad-data-overview-summary-metrics::before {
  content: "广告汇总";
}

#app-shell #view .ad-report-summary-cards::before {
  content: "报告汇总";
}

#app-shell #view .automation-list-metrics::before {
  content: "托管汇总";
}

#app-shell #view .ad-metric-strip::-webkit-scrollbar {
  display: none;
}

#app-shell #view .ad-metric-strip .ad-metric-item,
#app-shell #view .ad-metric-strip > span {
  position: relative;
  width: auto;
  min-width: 0;
  min-height: 42px;
  box-sizing: border-box;
  margin: 0;
  padding: 4px 10px 3px;
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#app-shell #view .ad-metric-strip .ad-metric-item + .ad-metric-item::before,
#app-shell #view .ad-metric-strip > span + span::before {
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 0;
  display: block;
  width: 1px;
  content: "";
  background: rgba(60, 60, 67, 0.12);
  pointer-events: none;
}

/* Cached app.js used direct spans. Match the semantic dt/dd treatment. */
#app-shell #view .ad-metric-strip > span {
  color: #6e6e73;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: 0;
  white-space: nowrap;
}

#app-shell #view .ad-metric-strip dt {
  max-width: 100%;
  overflow: hidden;
  color: #6e6e73;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#app-shell #view .ad-metric-strip dd,
#app-shell #view .ad-metric-strip > span strong {
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  color: #1d1d1f !important;
  font-size: 14px !important;
  font-weight: 680 !important;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  line-height: 1.05;
  letter-spacing: -0.016em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Advertising Data places optional batch actions after the card group. */
#app-shell #view .ad-data-overview-summary-head > div:first-child {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  overflow: visible;
}

#app-shell #view .ad-data-overview-summary-head .ad-metric-strip {
  width: auto;
  flex: 1 1 auto;
}

#app-shell #view .ad-data-overview-summary-head .ad-data-batch-actions {
  flex: 0 0 auto;
  align-self: center;
  margin: 0;
}

/* Report actions stay on the same level without becoming part of the cards. */
#app-shell #view .ad-metric-summary-head > .table-actions {
  flex: 0 0 auto;
  align-self: center;
  margin: 0 2px 0 auto;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
}

#app-shell #view .ad-report-summary-cards {
  width: auto;
  max-width: 100%;
  flex: 1 1 auto;
}

@media (max-width: 980px) {
  #app-shell #view .ad-metric-summary-head {
    flex-wrap: wrap;
  }

  #app-shell #view .ad-metric-summary-head > .table-actions {
    justify-content: flex-start;
  }

}

@media (max-width: 760px) {
  #app-shell #view .ad-data-overview-summary-head > div:first-child {
    flex-wrap: wrap;
  }

  #app-shell #view .ad-data-overview-summary-head .ad-data-batch-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

@media (max-width: 480px) {
  #app-shell #view .ad-metric-strip .ad-metric-item,
  #app-shell #view .ad-metric-strip > span {
    min-width: 0;
    padding-inline: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #app-shell #view .ad-metric-summary-head,
  #app-shell #view .ad-metric-strip,
  #app-shell #view .ad-metric-strip .ad-metric-item,
  #app-shell #view .ad-metric-strip > span {
    scroll-behavior: auto;
  }
}

/* Keep report metrics compact within the shared important-style layer. */
@layer apple-proportions {
#app-shell #view .ad-metric-strip.ad-report-summary-cards {
  grid-template-columns: 88px 170px 170px minmax(260px, max-content) minmax(0, 1fr) !important;
  max-width: 100% !important;
}


}

@layer apple-proportions {
  #app-shell #view .ad-report-summary-cards .ad-report-change {
    display: inline-flex; align-items: baseline; gap: 8px;
    font-size: 18px !important; font-weight: 600 !important;
    white-space: nowrap;
  }
  #app-shell #view .ad-report-summary-cards .ad-report-change.is-up { color: var(--ar-danger, #b42332) !important; }
  #app-shell #view .ad-report-summary-cards .ad-report-change.is-down { color: var(--ar-success, #237744) !important; }
  #app-shell #view .ad-report-summary-cards .ad-report-change.is-neutral { color: var(--ar-muted, #676b73) !important; }
  #app-shell #view .ad-report-summary-cards .ad-report-change-amount {
    color: inherit !important; font-size: 12px !important; font-weight: 400 !important;
  }
}
