/*
 * V303: final, page-scoped contrast repair for the passkey-free face + PIN
 * screens and the account-deletion confirmation form.
 *
 * This file is intentionally loaded after every global future-UI layer. It
 * restores the component palette without changing authentication, billing,
 * camera, PIN, deletion, or navigation behavior.
 */

body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content {
  --face-v303-ink: #122f2b;
  --face-v303-copy: #415d58;
  --face-v303-muted: #526b66;
  --face-v303-line: #8fb7af;
  --face-v303-surface: #f8fcfb;
  --face-v303-surface-strong: #ffffff;
  --face-v303-accent: #087d6a;
  --face-v303-accent-dark: #075e53;
}

/* Restore every intentionally light face-auth surface after the global dark
 * theme cascade. The page scope prevents this from affecting other screens. */
body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content :is(
  .face-auth-card,
  .face-security-summary,
  .face-settings-section,
  .face-recovery-result,
  .face-auth-consent,
  .face-auth-help-grid a,
  .face-device-item,
  .face-auth-summary-row > div,
  .face-recovery-codes
) {
  background: var(--face-v303-surface) !important;
  border-color: var(--face-v303-line) !important;
  color: var(--face-v303-ink) !important;
  text-shadow: none !important;
  opacity: 1 !important;
}

body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content :is(
  .face-auth-heading h1,
  .face-auth-heading h2,
  .face-auth-card h1,
  .face-auth-card h2,
  .face-auth-card h3,
  .face-security-summary h2,
  .face-security-summary h3,
  .face-settings-section h1,
  .face-settings-section h2,
  .face-settings-section h3,
  .face-recovery-result h2,
  .face-recovery-result h3,
  .face-auth-help-grid strong,
  .face-device-item strong,
  .face-auth-summary-row strong
) {
  color: var(--face-v303-ink) !important;
  -webkit-text-fill-color: var(--face-v303-ink) !important;
  text-shadow: none !important;
  opacity: 1 !important;
}

body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content :is(
  .face-auth-heading p,
  .face-auth-field-note,
  .face-auth-switch,
  .face-settings-section > p,
  .face-recovery-result > p,
  .face-security-summary > p,
  .face-security-summary li span,
  .face-auth-help-grid span,
  .face-device-item small,
  .face-auth-summary-row small,
  .face-auth-consent small
) {
  color: var(--face-v303-copy) !important;
  -webkit-text-fill-color: var(--face-v303-copy) !important;
  text-shadow: none !important;
  opacity: 1 !important;
}

body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content :is(
  .face-auth-fields > label:not(.face-auth-consent),
  .face-auth-pin-grid label,
  .face-settings-form label,
  .face-auth-consent strong,
  .face-security-summary li strong,
  .face-live-instruction,
  .face-recovery-codes li
) {
  color: #203f3a !important;
  -webkit-text-fill-color: #203f3a !important;
  text-shadow: none !important;
  opacity: 1 !important;
}

body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content :is(
  .face-auth-fields input,
  .face-auth-fields textarea,
  .face-auth-fields select,
  .face-settings-form input,
  .face-settings-form textarea,
  .face-settings-form select
) {
  background: var(--face-v303-surface-strong) !important;
  border: 1px solid #527f77 !important;
  color: #102e2a !important;
  -webkit-text-fill-color: #102e2a !important;
  caret-color: #075e53 !important;
  opacity: 1 !important;
  box-shadow: inset 0 0 0 1px rgba(7, 94, 83, .05) !important;
}

body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content :is(
  .face-auth-fields input,
  .face-auth-fields textarea,
  .face-settings-form input,
  .face-settings-form textarea
)::placeholder {
  color: #546d68 !important;
  -webkit-text-fill-color: #546d68 !important;
  opacity: 1 !important;
}

body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content :is(
  .face-auth-fields input,
  .face-settings-form input,
  .face-settings-form textarea
):focus-visible {
  border-color: #087d6a !important;
  outline: 3px solid rgba(8, 125, 106, .24) !important;
  outline-offset: 2px !important;
}

body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content .face-auth-consent a,
body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content .face-auth-switch a,
body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content .face-settings-section a:not(.button) {
  color: #075e53 !important;
  -webkit-text-fill-color: #075e53 !important;
  text-decoration-color: currentColor !important;
}

/* Badges and light step cards had inherited nearly-white text from the global
 * app theme. Pin both sides of each text/background pair explicitly. */
body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content .face-auth-badge {
  background: #e2f5f0 !important;
  color: #075e53 !important;
  -webkit-text-fill-color: #075e53 !important;
  border-color: #9ccbc1 !important;
  opacity: 1 !important;
}

body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content .face-auth-badge.is-success {
  background: #e3f6e9 !important;
  color: #145f36 !important;
  -webkit-text-fill-color: #145f36 !important;
}

body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content .face-live-steps li {
  background: #eef3f2 !important;
  border: 1px solid #c2d4d0 !important;
  color: #395651 !important;
  -webkit-text-fill-color: #395651 !important;
  opacity: 1 !important;
}

body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content .face-live-steps li > span {
  background: #d7e5e2 !important;
  color: #264640 !important;
  -webkit-text-fill-color: #264640 !important;
  opacity: 1 !important;
}

body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content .face-live-steps li.is-active {
  background: #dff4ee !important;
  border-color: #4da793 !important;
  color: #064f45 !important;
  -webkit-text-fill-color: #064f45 !important;
  font-weight: 800 !important;
}

body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content .face-live-steps li.is-active > span {
  background: #087d6a !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

/* Camera surfaces remain dark and always use high-contrast light copy. */
body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content .face-video-shell {
  background: linear-gradient(145deg, #102826, #071817) !important;
  border-color: rgba(176, 233, 221, .32) !important;
}

body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content .face-camera-placeholder,
body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content .face-camera-placeholder strong {
  color: #f4fffd !important;
  -webkit-text-fill-color: #f4fffd !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .55) !important;
  opacity: 1 !important;
}

body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content .face-camera-placeholder span {
  color: #c8e4de !important;
  -webkit-text-fill-color: #c8e4de !important;
  opacity: 1 !important;
}

body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content .face-auth-status {
  color: #284d47 !important;
  -webkit-text-fill-color: #284d47 !important;
  opacity: 1 !important;
}
body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content .face-auth-status.is-working { color: #245b51 !important; -webkit-text-fill-color: #245b51 !important; }
body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content .face-auth-status.is-warning { color: #744700 !important; -webkit-text-fill-color: #744700 !important; }
body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content .face-auth-status.is-error { color: #8e2029 !important; -webkit-text-fill-color: #8e2029 !important; }
body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content .face-auth-status.is-success { color: #145f36 !important; -webkit-text-fill-color: #145f36 !important; }

body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content .face-login-id-result {
  background: #143d37 !important;
  border-color: #43877b !important;
  color: #f0fffb !important;
}
body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content .face-login-id-result small { color: #c4e1da !important; -webkit-text-fill-color: #c4e1da !important; }
body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content .face-login-id-result strong { color: #ffffff !important; -webkit-text-fill-color: #ffffff !important; }

body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content :is(.alert.warning, .alert.info, .alert.success) {
  opacity: 1 !important;
  text-shadow: none !important;
}
body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content .alert.warning {
  background: #fff3cf !important;
  border-color: #c58c1d !important;
  color: #4e3500 !important;
  -webkit-text-fill-color: #4e3500 !important;
}
body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content .alert.info {
  background: #e8f4ff !important;
  border-color: #6e9ec4 !important;
  color: #173d5a !important;
  -webkit-text-fill-color: #173d5a !important;
}
body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content .alert.success {
  background: #e4f7eb !important;
  border-color: #5da676 !important;
  color: #174f2c !important;
  -webkit-text-fill-color: #174f2c !important;
}

body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content :is(.button.primary, .face-start-button, .button.danger) {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  opacity: 1 !important;
}
body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content .button:not(.primary):not(.danger) {
  background: #ffffff !important;
  border-color: #5d8c83 !important;
  color: #143d37 !important;
  -webkit-text-fill-color: #143d37 !important;
}

/* The minimal face-auth header/footer sit on the cosmic dark shell, so their
 * navigation text must not inherit the dark color used inside light cards. */
body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) :is(.face-auth-site-nav a, .face-auth-minimal-footer a) {
  color: #bdf4e9 !important;
  -webkit-text-fill-color: #bdf4e9 !important;
}
body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) .face-auth-minimal-footer {
  color: #d3e8e4 !important;
  -webkit-text-fill-color: #d3e8e4 !important;
  border-color: rgba(181, 234, 223, .32) !important;
}

/* Account deletion: keep the danger panel dark, but make every form label and
 * confirmation surface unambiguous once deletion is allowed. */
body.page-account_delete #main-content .panel.danger-zone {
  color: #f4f8ff !important;
}
body.page-account_delete #main-content .panel.danger-zone :is(h1, h2, h3, p.muted, .search-form > label:not(.choice)) {
  color: #f4f8ff !important;
  -webkit-text-fill-color: #f4f8ff !important;
  text-shadow: none !important;
  opacity: 1 !important;
}
body.page-account_delete #main-content .panel.danger-zone p.muted {
  color: #d6e2f0 !important;
  -webkit-text-fill-color: #d6e2f0 !important;
}
body.page-account_delete #main-content .panel.danger-zone :is(input[type="email"], input[type="text"], textarea) {
  background: #ffffff !important;
  border: 1px solid #7593ae !important;
  color: #172b3a !important;
  -webkit-text-fill-color: #172b3a !important;
  caret-color: #172b3a !important;
  opacity: 1 !important;
}
body.page-account_delete #main-content .panel.danger-zone :is(input[type="email"], input[type="text"], textarea)::placeholder {
  color: #5b6b79 !important;
  -webkit-text-fill-color: #5b6b79 !important;
  opacity: 1 !important;
}
body.page-account_delete #main-content .panel.danger-zone .choice {
  background: #f8fbff !important;
  border: 1px solid #9ab0c3 !important;
  color: #172b3a !important;
  -webkit-text-fill-color: #172b3a !important;
  text-shadow: none !important;
  opacity: 1 !important;
}
body.page-account_delete #main-content .panel.danger-zone .choice input {
  accent-color: #b4232e !important;
}
body.page-account_delete #main-content .panel.danger-zone .alert.warning {
  background: #fff2ce !important;
  border-color: #c48a18 !important;
  color: #4d3300 !important;
  -webkit-text-fill-color: #4d3300 !important;
  opacity: 1 !important;
}
body.page-account_delete #main-content .panel.danger-zone .button.danger {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

@media (forced-colors: active) {
  body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content :is(
    .face-auth-card,
    .face-security-summary,
    .face-settings-section,
    .face-recovery-result
  ) {
    forced-color-adjust: auto;
  }
}


/* Settings-only choice rows and autofill need an explicit pair too. */
body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content .face-settings-form .choice {
  background: #f8fcfb !important;
  border: 1px solid #9bbdb6 !important;
  color: #173d37 !important;
  -webkit-text-fill-color: #173d37 !important;
  opacity: 1 !important;
}
body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content :is(
  .face-auth-fields input,
  .face-settings-form input
):-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
  -webkit-text-fill-color: #102e2a !important;
  caret-color: #102e2a !important;
}
body:is(.page-face_register, .page-face_login, .page-face_recovery, .page-face_auth_settings) #main-content :is(
  .face-security-summary a,
  .face-auth-help-grid a,
  .alert a
) {
  text-decoration-thickness: .08em !important;
  text-underline-offset: .16em !important;
}

/* When deletion is blocked, navigation buttons must stay readable on the dark
 * danger panel; when it is allowed, every confirmation label remains visible. */
body.page-account_delete #main-content .panel.danger-zone .inline-actions .button:not(.danger) {
  background: #ffffff !important;
  border-color: #7996af !important;
  color: #173047 !important;
  -webkit-text-fill-color: #173047 !important;
}
body.page-account_delete #main-content .panel.danger-zone .alert.warning a {
  color: #604000 !important;
  -webkit-text-fill-color: #604000 !important;
  text-decoration: underline !important;
  text-underline-offset: .16em !important;
}

/* V304: the registered browser identifies its local face account internally.
 * No face-login ID field is exposed on the login form. */
body.page-face_login #main-content .face-device-autodetect {
  display: grid !important;
  grid-template-columns: 38px minmax(0, 1fr) !important;
  gap: 11px !important;
  align-items: center !important;
  padding: 13px 14px !important;
  border: 1px solid #8fb7af !important;
  border-radius: 14px !important;
  background: #f4faf8 !important;
  color: #173d37 !important;
  -webkit-text-fill-color: #173d37 !important;
  opacity: 1 !important;
}
body.page-face_login #main-content .face-device-autodetect-icon {
  display: grid !important;
  place-items: center !important;
  width: 38px !important;
  height: 38px !important;
  border-radius: 12px !important;
  background: #dcefeb !important;
  color: #075e53 !important;
  -webkit-text-fill-color: #075e53 !important;
}
body.page-face_login #main-content .face-device-autodetect > span:last-child {
  display: grid !important;
  gap: 3px !important;
}
body.page-face_login #main-content .face-device-autodetect strong {
  color: #173d37 !important;
  -webkit-text-fill-color: #173d37 !important;
  font-weight: 800 !important;
}
body.page-face_login #main-content .face-device-autodetect small {
  color: #4b6661 !important;
  -webkit-text-fill-color: #4b6661 !important;
  line-height: 1.55 !important;
}
body.page-face_login #main-content .face-device-autodetect.is-ready {
  border-color: #4b9a7a !important;
  background: #e8f7ef !important;
}
body.page-face_login #main-content .face-device-autodetect.is-ready .face-device-autodetect-icon {
  background: #17704a !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}
body.page-face_login #main-content .face-device-autodetect.is-working {
  border-color: #6d9bad !important;
  background: #eaf5f8 !important;
}
body.page-face_login #main-content .face-device-autodetect.is-warning {
  border-color: #c58c1d !important;
  background: #fff3cf !important;
}
body.page-face_login #main-content .face-device-autodetect.is-warning .face-device-autodetect-icon {
  background: #8a5a00 !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}
