/* SitePulse Portal Factory V37. Presentation only; application CSS and JS stay intact. */
html[data-sitepulse-branding="v37"] {
  --sp-brand-logo: url('/sitepulse/branding-v37/sitepulse-pro-master.png');
  --sp-brand-factory: url('/sitepulse/branding-v37/sitepulse-factory.webp');
  --sp-brand-monochrome: url('/sitepulse/branding-v37/sitepulse-factory-monochrome.webp');
  --sp-brand-paper: #f8fafc;
}

/* Original V35/V36 factory artwork. The login does not contain the sleep animation. */
html[data-sitepulse-branding="v37"] .login-page {
  box-sizing: border-box;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  display: grid;
  place-items: center;
  position: relative;
  overflow: auto;
  padding: max(28px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  background: #f8fbff var(--sp-brand-factory) center center / cover no-repeat !important;
  background-attachment: scroll !important;
}
html[data-sitepulse-branding="v37"] .login-page::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255,255,255,.04), rgba(255,255,255,0) 45%, rgba(255,255,255,.035));
  pointer-events: none;
}
html[data-sitepulse-branding="v37"] .login-page :is(.login-glow, .pulse-stage, .pulse-ring) {
  display: none !important;
  animation: none !important;
}
html[data-sitepulse-branding="v37"] .login-page .login-card {
  box-sizing: border-box;
  position: relative;
  width: min(100%, 460px);
  max-width: 100%;
  min-height: min(600px, calc(100dvh - 56px));
  margin: 0;
  padding: 42px 38px 34px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 28px;
  background: rgba(255,255,255,.985) !important;
  box-shadow: 0 20px 65px rgba(4,30,58,.21);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
html[data-sitepulse-branding="v37"] .login-heading[data-sp-brand-heading] {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 0 auto clamp(24px, 4vh, 36px);
  width: 100%;
}
html[data-sitepulse-branding="v37"] [data-sp-brand-heading] > :not([data-sp-brand-generated]) {
  display: none !important;
}
html[data-sitepulse-branding="v37"] .login-heading > img[data-sp-canonical] {
  display: block !important;
  width: min(100%, 360px) !important;
  height: auto !important;
  max-height: none !important;
  aspect-ratio: 1910 / 407;
  object-fit: contain !important;
}
html[data-sitepulse-branding="v37"] .sp-brand-login-strap {
  margin: 0;
  color: #34516f;
  font-family: inherit;
  font-size: clamp(10px, 1.1vw, 12px);
  line-height: 1.5;
  font-weight: 500;
  letter-spacing: .025em;
  text-align: center;
}
html[data-sitepulse-branding="v37"] .login-form { width: 100%; }
html[data-sitepulse-branding="v37"] .login-form :is(input, button) { box-sizing: border-box; max-width: 100%; }
/* Fields, submit handlers, validation, focus styles and disabled states are inherited. */

/* Canonical artwork in existing, still-functional home buttons and report/VT headers. */
html[data-sitepulse-branding="v37"] img[data-sp-canonical] {
  object-fit: contain !important;
  object-position: left center !important;
  aspect-ratio: 1910 / 407;
  height: auto !important;
  transform: none !important;
  filter: none !important;
}
html[data-sitepulse-branding="v37"] :is(.elite-brand-v7, .sitepulse-canonical-brand) > img[data-sp-canonical],
html[data-sitepulse-branding="v37"] img.sitepulse-header-logo[data-sp-canonical] {
  display: block;
  width: clamp(164px, 17vw, 245px) !important;
  max-width: 100%;
  max-height: 60px !important;
}
html[data-sitepulse-branding="v37"] :is(.pro-logo-crop, .brand-pro, .brand-logo-crop) {
  overflow: visible;
}
html[data-sitepulse-branding="v37"] .pro-logo-crop {
  width: min(245px, 100%) !important;
  height: auto !important;
  aspect-ratio: 1910 / 407;
  display: inline-flex;
  align-items: center;
}
html[data-sitepulse-branding="v37"] .pro-logo-crop img[data-sp-canonical] {
  width: 100% !important;
  max-width: 100% !important;
  max-height: none !important;
  margin: 0 !important;
}
html[data-sitepulse-branding="v37"] .sitepulse-vt-logo[data-sp-canonical] {
  width: 190px !important;
  max-width: 100% !important;
}
html[data-sitepulse-branding="v37"] [data-sp-brand-container] {
  min-width: 0;
  min-height: 48px;
  overflow: visible;
}
html[data-sitepulse-branding="v37"] [data-sp-brand-container] > :not([data-sp-brand-generated]) {
  display: none !important;
}
html[data-sitepulse-branding="v37"] [data-sp-brand-container] > img[data-sp-canonical] {
  display: block;
  width: min(100%, 210px) !important;
  max-width: 100%;
  max-height: 52px !important;
}

/* One quiet, neutral backdrop behind working areas, never over the data. */
html[data-sitepulse-branding="v37"] body {
  background-color: var(--sp-brand-paper);
}
html[data-sitepulse-branding="v37"] :is(.sp-lab, .sentinel-shell, .app-shell, .reports-app, .vt-app) {
  background-color: var(--sp-brand-paper) !important;
  background-image: linear-gradient(rgba(248,250,252,.94), rgba(248,250,252,.955)), var(--sp-brand-monochrome) !important;
  background-position: center, center bottom !important;
  background-size: cover, cover !important;
  background-repeat: no-repeat !important;
  background-attachment: scroll, fixed !important;
}
html[data-sitepulse-branding="v37"] :is(.sp-lab, .sentinel-shell) > .workspace,
html[data-sitepulse-branding="v37"] .sp-lab :is(.main, .main-content, .workspace-content, .portal-home, .estate-home),
html[data-sitepulse-branding="v37"] .sentinel-shell > .workspace > .content {
  background-color: transparent !important;
  background-image: none !important;
}
/* These are workspace surfaces, not table, chart, canvas, or card selectors. */
html[data-sitepulse-branding="v37"] :is(.portal-home, .estate-home, .estate-page, .sp-settings-surface, .cloud-panel, .reports-shell, .vt-shell) {
  background-color: var(--sp-brand-paper) !important;
  background-image: linear-gradient(rgba(248,250,252,.94), rgba(248,250,252,.96)), var(--sp-brand-monochrome) !important;
  background-position: center, center bottom !important;
  background-size: cover, cover !important;
  background-repeat: no-repeat !important;
}
html[data-sitepulse-branding="v37"] :is(.portal-grid > article, .sp-settings-card) {
  background-color: #fff;
}
/* TV production canvases and live charts retain their own original rendering. */
html[data-sitepulse-branding="v37"][data-sp-brand-display="true"] :is(.sp-lab, .main, .workspace, .app-shell) {
  background-image: none !important;
}

@media (max-width: 760px) {
  html[data-sitepulse-branding="v37"] .login-page {
    padding: max(16px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  }
  html[data-sitepulse-branding="v37"] .login-page .login-card {
    width: min(100%, 430px);
    min-height: min(570px, calc(100dvh - 32px));
    padding: 30px 24px;
    border-radius: 24px;
  }
  html[data-sitepulse-branding="v37"] :is(.sp-lab, .sentinel-shell, .app-shell, .reports-app, .vt-app) {
    background-attachment: scroll, scroll !important;
  }
}
@media (max-width: 500px) {
  html[data-sitepulse-branding="v37"] .login-heading > img[data-sp-canonical] { width: min(100%, 280px) !important; }
  html[data-sitepulse-branding="v37"] .login-heading[data-sp-brand-heading] { margin-bottom: 26px; }
}
@media (max-height: 520px) {
  html[data-sitepulse-branding="v37"] .login-page .login-card { min-height: 0; padding-block: 24px; }
}

/* Analytics has its own authentication form; preserve it, match its presentation. */
html[data-sitepulse-branding="v37"] .cloud-login {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  box-sizing: border-box;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 28px 24px;
  background: #f8fbff var(--sp-brand-factory) center / cover no-repeat !important;
}
html[data-sitepulse-branding="v37"] .cloud-login::before,
html[data-sitepulse-branding="v37"] .cloud-login::after,
html[data-sitepulse-branding="v37"] .cloud-login-brand,
html[data-sitepulse-branding="v37"] .cloud-login-form > .cloud-login-icon,
html[data-sitepulse-branding="v37"] .cloud-login-form > h2,
html[data-sitepulse-branding="v37"] .cloud-login-form > h2 + p {
  display: none !important;
}
html[data-sitepulse-branding="v37"] .cloud-login-form {
  box-sizing: border-box;
  position: relative;
  width: min(100%, 460px);
  min-height: 600px;
  max-width: 100%;
  margin: 0;
  padding: 38px;
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 28px;
  background: rgba(255,255,255,.985) !important;
  box-shadow: 0 20px 65px rgba(4,30,58,.21);
}
html[data-sitepulse-branding="v37"] .cloud-login-form .login-heading { margin-bottom: 32px; }
html[data-sitepulse-branding="v37"] .cloud-login-form > input { min-height: 50px; font-size: 16px; }
html[data-sitepulse-branding="v37"] .cloud-login-form > button[type="submit"] { min-height: 50px; }
@media(max-width:760px) {
  html[data-sitepulse-branding="v37"] .cloud-login { padding: 16px 14px; }
  html[data-sitepulse-branding="v37"] .cloud-login-form { min-height: 0; padding: 30px 24px; border-radius: 24px; }
}

@media (forced-colors: active) {
  html[data-sitepulse-branding="v37"] :is(.login-page, .cloud-login, .sp-lab, .sentinel-shell, .app-shell, .reports-app, .vt-app, .portal-home, .estate-home, .estate-page, .sp-settings-surface, .cloud-panel, .reports-shell, .vt-shell) { background-image: none !important; background-color: Canvas !important; }
  html[data-sitepulse-branding="v37"] .login-page .login-card { background: Canvas !important; border-color: CanvasText; box-shadow: none; }
}
@media print {
  html[data-sitepulse-branding="v37"] :is(body, .login-page, .cloud-login, .sp-lab, .sentinel-shell, .app-shell, .reports-app, .vt-app, .portal-home, .estate-home, .estate-page, .sp-settings-surface, .cloud-panel, .reports-shell, .vt-shell) { background: #fff !important; }
  html[data-sitepulse-branding="v37"] .login-page::before { display: none !important; }
}
