:root { --site-compliance-height: calc(28px + env(safe-area-inset-bottom, 0px)); }

html body:has(> #app):has(> .site-compliance-footer) {
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 100dvh;
}
body:has(> .site-compliance-footer) > #app {
  flex: 1 0 auto;
  height: auto;
}
/* The fixed admin header can stay in place while the page itself scrolls. */
body:has(> .site-compliance-footer) #app .main-container:has(.fixed-header):not(.fullscreen-mode) {
  height: auto;
  overflow: visible;
}
body:has(> .site-compliance-footer) #app .main-container:not(.fullscreen-mode) .fixed-header + .app-main {
  height: auto;
  min-height: calc(100dvh - 50px - var(--site-compliance-height));
  overflow: clip;
}
body:has(> .site-compliance-footer) #app .hasTagsView .main-container:not(.fullscreen-mode) .fixed-header + .app-main {
  min-height: calc(100dvh - 84px - var(--site-compliance-height));
}
body:has(> #app .main-container.fullscreen-mode):has(> .site-compliance-footer) {
  overflow-y: auto !important;
}
body:has(> .site-compliance-footer) #app .main-container.fullscreen-mode {
  position: relative;
  inset: auto;
  width: 100%;
  height: auto;
  overflow: visible;
  padding-top: 34px;
}
body:has(> .site-compliance-footer) #app .main-container.fullscreen-mode .app-main {
  position: relative;
  inset: auto;
  height: auto !important;
  min-height: calc(100dvh - 34px - var(--site-compliance-height)) !important;
  overflow: clip;
}
#app .solo-shell { min-height: calc(100dvh - var(--site-compliance-height)); }

/* Standalone extension connection pages use their own centered grid. */
html body:not(:has(> #app)):has(> .site-compliance-footer) {
  grid-template-rows: 1fr auto;
}

.site-compliance-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-sizing: border-box;
  min-height: var(--site-compliance-height);
  padding: 0 12px env(safe-area-inset-bottom, 0px);
  border: 0;
  background: transparent;
  color: #64748b;
  font: 12px/24px "Microsoft YaHei", "PingFang SC", sans-serif;
}
.site-compliance-footer a { color: inherit; text-decoration: none; white-space: nowrap; }
.site-compliance-footer a:hover { text-decoration: underline; }
.site-compliance-footer a:focus-visible { outline: 2px solid #c2410c; outline-offset: 2px; }
html.dark .site-compliance-footer,
:root[data-solo-theme='dark'] .site-compliance-footer { color: #cbd5e1; }

.site-compliance-copyright { display: none; white-space: nowrap; }
body:has(> #app .mall-root) > .site-compliance-footer > .site-compliance-copyright,
body:has(> #app > :is(.login, .register) > :is(.el-login-footer, .el-register-footer) > span:not(:empty)) > .site-compliance-footer > .site-compliance-copyright,
body:has(> #app .app-main > .copyright > span:not(:empty)) > .site-compliance-footer > .site-compliance-copyright {
  display: inline;
}
body:has(> .site-compliance-footer > .site-compliance-copyright) #app :is(
  .mall-root .distribution-footer,
  .login > .el-login-footer,
  .register > .el-register-footer,
  .app-main > .copyright
) { display: none; }

body:has(> #app .mall-root):has(> .site-compliance-footer) { background-color: #f5f7f9; }
body:has(> #app .mall-root) > .site-compliance-footer { color: #475569; }

/* Continue the existing auth background behind the in-flow final row. */
body:has(> #app > :is(.login, .register, .lock-container)) {
  --site-compliance-height: calc(40px + env(safe-area-inset-bottom, 0px));
}
body:has(> .site-compliance-footer) #app > :is(.login, .register) {
  min-height: 100dvh;
  margin-bottom: calc(-1 * var(--site-compliance-height));
  padding-bottom: max(64px, var(--site-compliance-height));
}
body:has(> #app > :is(.login, .register)) > .site-compliance-footer {
  position: relative;
  z-index: 1;
}
body:has(> #app > .lock-container):has(> .site-compliance-footer) {
  background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
}
body:has(> .site-compliance-footer) #app > .lock-container {
  position: relative;
  inset: auto;
  z-index: auto;
  min-height: calc(100dvh - var(--site-compliance-height));
  background: transparent;
}
body:has(> #app > :is(.login, .register, .lock-container)) > .site-compliance-footer {
  color: #fff;
  text-shadow: 0 1px 3px #000;
}

/* Leave clearance after the footer when a business toolbar is fixed on screen. */
body:has(> #app :is(.solo-order-pagination, .purchase-pagination-row, .official-pagination-row,
                   .pdd-purchased-page .pagination-row, .selection-bar, .batch-bar, .bottom-nav, .detail-actions))
  > .site-compliance-footer { margin-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
@media (max-width: 640px) {
  body:has(> #app :is(.solo-order-pagination, .purchase-pagination-row, .official-pagination-row,
                     .pdd-purchased-page .pagination-row, .selection-bar, .batch-bar, .bottom-nav, .detail-actions))
    > .site-compliance-footer { margin-bottom: calc(104px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 360px) {
  .site-compliance-footer { gap: 8px; padding-inline: 6px; font-size: 11px; }
}
@media print {
  .site-compliance-footer { display: none; }
  html body:has(> #app):has(> .site-compliance-footer) { display: block; min-height: 0; }
}
