/* Shared theme contract for sign-in, registration, password recovery, and legal pages. */
html[data-theme="light"] body.auth-document,
html[data-theme="light"] .legal-page {
  color-scheme: light;
  --entry-text: #17263e;
  --entry-muted: #607089;
  --entry-surface: #ffffff;
  --entry-surface-soft: #f3f6fa;
  --entry-border: #d9e2ed;
  --entry-link: #176bc0;
  --entry-action: #1268b2;
  --entry-action-hover: #0f5c9e;
  --entry-action-text: #ffffff;
  --entry-focus: #176bc0;
}

html[data-theme="dark"] body.auth-document,
html[data-theme="dark"] .legal-page {
  color-scheme: dark;
  --entry-text: #edf3fb;
  --entry-muted: #a3b0c2;
  --entry-surface: #111820;
  --entry-surface-soft: #17212d;
  --entry-border: #2b3949;
  --entry-link: #91c9ff;
  --entry-action: #1a68a8;
  --entry-action-hover: #15588f;
  --entry-action-text: #ffffff;
  --entry-focus: #78baff;
}

html[data-theme="light"] body.auth-document {
  background: #f5f8fc;
  color: var(--entry-text);
}

html[data-theme="light"] body.auth-document .auth-video-background span {
  background: linear-gradient(90deg,rgba(245,248,252,.88),rgba(245,248,252,.62) 50%,rgba(245,248,252,.84)),linear-gradient(0deg,rgba(245,248,252,.72),rgba(255,255,255,.16) 45%);
}

html[data-theme="light"] body.auth-document .auth-premium-page {
  background: transparent;
  color: var(--entry-text);
}

html[data-theme="light"] body.auth-document .auth-premium-main {
  background: rgba(248,250,253,.94);
}

html[data-theme="light"] body.auth-document .auth-premium-box {
  border-color: rgba(210,220,233,.94);
  background: rgba(255,255,255,.96);
  box-shadow: 0 18px 48px rgba(27,48,79,.09);
}

html[data-theme="light"] body.auth-document :is(.auth-premium-side h1,.auth-form-heading h2,.auth-premium-box h2),
html[data-theme="light"] body.auth-document .auth-form .form-group label {
  color: var(--entry-text);
}

html[data-theme="light"] body.auth-document :is(.auth-side-content>p,.auth-form-heading p,.auth-form-legal,.auth-divider) {
  color: var(--entry-muted);
}

html[data-theme="light"] body.auth-document :is(.auth-back-link,.auth-form-legal a,.auth-label-row a) {
  color: var(--entry-link);
}

html[data-theme="light"] body.auth-document .auth-form .form-control {
  border-color: var(--entry-border);
  background: var(--entry-surface);
  color: var(--entry-text);
}

html[data-theme="light"] body.auth-document .auth-form .form-control::placeholder {
  color: #7d899a;
}

html[data-theme="light"] body.auth-document :is(.auth-form-eyebrow,.auth-kicker,.auth-tool-card) {
  border-color: var(--entry-border);
  background: var(--entry-surface-soft);
  color: var(--entry-muted);
}

html[data-theme="dark"] body.auth-document {
  background: #080a0d;
  color: var(--entry-text);
}

html[data-theme="dark"] body.auth-document .auth-premium-page {
  background: transparent;
  color: var(--entry-text);
}

html[data-theme="dark"] body.auth-document .auth-premium-main {
  background: rgba(8,10,13,.94);
}

html[data-theme="dark"] body.auth-document .auth-premium-box {
  border-color: var(--entry-border);
  background: rgba(17,20,24,.96);
  box-shadow: 0 18px 48px rgba(0,0,0,.28);
}

html[data-theme="dark"] body.auth-document :is(.auth-premium-side h1,.auth-form-heading h2,.auth-premium-box h2),
html[data-theme="dark"] body.auth-document .auth-form .form-group label {
  color: var(--entry-text);
}

html[data-theme="dark"] body.auth-document :is(.auth-side-content>p,.auth-form-heading p,.auth-form-legal,.auth-divider,.auth-tool-card small) {
  color: var(--entry-muted);
}

html[data-theme="dark"] body.auth-document :is(.auth-back-link,.auth-form-legal a,.auth-label-row a) {
  color: var(--entry-link);
}

html[data-theme="dark"] body.auth-document .auth-form .form-control {
  border-color: var(--entry-border);
  background: var(--entry-surface-soft);
  color: var(--entry-text);
}

html[data-theme="dark"] body.auth-document .auth-form .form-control::placeholder {
  color: #8795a8;
}

html[data-theme="dark"] body.auth-document :is(.auth-form-eyebrow,.auth-kicker,.auth-tool-card) {
  border-color: var(--entry-border);
  background: var(--entry-surface-soft);
  color: var(--entry-link);
}

html[data-theme="light"] :is(body.auth-document,.legal-page) :is(.btn-secondary,.btn-outline,.auth-password-toggle,.auth-social-btn) {
  border-color: var(--entry-border);
  background: var(--entry-surface);
  color: var(--entry-text);
}

html[data-theme="dark"] :is(body.auth-document,.legal-page) :is(.btn-secondary,.btn-outline,.auth-password-toggle,.auth-social-btn) {
  border-color: var(--entry-border);
  background: var(--entry-surface-soft);
  color: var(--entry-text);
}

html[data-theme="light"] :is(body.auth-document,.legal-page) .btn-primary {
  border-color: var(--entry-action);
  background: var(--entry-action);
  color: var(--entry-action-text);
  -webkit-text-fill-color: var(--entry-action-text);
  box-shadow: 0 8px 20px rgba(18,104,178,.18);
}

html[data-theme="dark"] :is(body.auth-document,.legal-page) .btn-primary {
  border-color: var(--entry-action);
  background: var(--entry-action);
  color: var(--entry-action-text);
  -webkit-text-fill-color: var(--entry-action-text);
  box-shadow: 0 8px 22px rgba(0,0,0,.24);
}

html[data-theme="light"] :is(body.auth-document,.legal-page) :is(.btn-secondary,.btn-outline,.auth-password-toggle,.auth-social-btn):hover {
  border-color: #afc1d7;
  background: #edf3f9;
}

html[data-theme="dark"] :is(body.auth-document,.legal-page) :is(.btn-secondary,.btn-outline,.auth-password-toggle,.auth-social-btn):hover {
  border-color: #43566d;
  background: #202d3b;
}

html[data-theme="light"] :is(body.auth-document,.legal-page) .btn-primary:hover:not(:disabled) {
  border-color: var(--entry-action-hover);
  background: var(--entry-action-hover);
}

html[data-theme="dark"] :is(body.auth-document,.legal-page) .btn-primary:hover:not(:disabled) {
  border-color: var(--entry-action-hover);
  background: var(--entry-action-hover);
}

html[data-theme="light"] .legal-page {
  color-scheme: light;
  background: #f5f7fa;
}

html[data-theme="dark"] .legal-page {
  color-scheme: dark;
  background: #080a0d;
}

html[data-theme="light"] .legal-page :is(.legal-hero,.legal-article,.legal-intro,.legal-meta span) {
  color-scheme: light;
}

html[data-theme="light"] .legal-page :is(.legal-hero h1,.legal-intro h2,.legal-article h3) {
  color: var(--entry-text);
}

html[data-theme="light"] .legal-page :is(.legal-hero p,.legal-intro p,.legal-article section p,.legal-aside>small) {
  color: var(--entry-muted);
}

html[data-theme="light"] .legal-page .legal-article {
  border-color: var(--entry-border);
  background: var(--entry-surface);
  box-shadow: 0 18px 48px rgba(27,48,79,.07);
}

html[data-theme="light"] .legal-page .legal-intro {
  border-color: var(--entry-border);
  background: linear-gradient(145deg,#fff,#f3f7fc);
}

html[data-theme="light"] .legal-page .legal-article>section {
  border-color: var(--entry-border);
}

html[data-theme="dark"] .legal-page :is(.legal-hero h1,.legal-intro h2,.legal-article h3) {
  color: var(--entry-text);
}

html[data-theme="dark"] .legal-page :is(.legal-hero p,.legal-intro p,.legal-article section p,.legal-aside>small) {
  color: var(--entry-muted);
}

html[data-theme="dark"] .legal-page .legal-article {
  border-color: var(--entry-border);
  background: var(--entry-surface);
  box-shadow: none;
}

html[data-theme="dark"] .legal-page .legal-intro {
  border-color: var(--entry-border);
  background: linear-gradient(145deg,#171d25,#111820);
}

html[data-theme="dark"] .legal-page .legal-article>section {
  border-color: var(--entry-border);
}

:is(body.auth-document,.legal-page) :where(a,button,input,summary):focus-visible {
  outline: 3px solid var(--entry-focus);
  outline-offset: 3px;
}

@media (max-width: 850px) {
  html[data-theme="light"] body.auth-document .auth-premium-main {
    background: rgba(246,249,253,.9);
  }
  html[data-theme="dark"] body.auth-document .auth-premium-main {
    background: rgba(8,10,13,.9);
  }
}

@media (prefers-reduced-motion: reduce) {
  :is(body.auth-document,.legal-page) :where(a,button) {
    scroll-behavior: auto;
  }
}
