/* Vanilla Noir auth — crisp liquid glass on plain deep bg (no backdrop blur) */

.auth-view {
  --vn-deep: var(--bg);
  --vn-surface: var(--surface);
  --vn-earth: var(--surface-3);
  --vn-ivory: var(--text);
  --vn-cream: var(--text-warm);
  --vn-ivory-muted: rgba(243, 233, 210, 0.72);
  --vn-edge: rgba(243, 233, 210, 0.28);
  --vn-input-well: #1a1a1a;
  --vn-control-h: 44px;
  --vn-control-pad-x: 12px;
  --vn-control-icon-w: 38px;
  --vn-motion: 140ms cubic-bezier(0.25, 1, 0.5, 1);

  position: relative;
  display: grid;
  min-height: 100svh;
  isolation: isolate;
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
  color: var(--vn-ivory);
  background: var(--vn-deep);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
}

.auth-view[hidden] {
  display: none !important;
}

.auth-view a {
  color: var(--vn-cream);
}

.auth-view .field-hint,
.auth-view .password-status,
.auth-view .auth-footnote,
.auth-view .auth-copy p,
.auth-view .auth-brand span {
  color: var(--vn-ivory-muted);
}

.auth-view .field > span:first-child {
  color: var(--vn-ivory);
}

.auth-view .auth-copy h1,
.auth-view .auth-brand strong,
.auth-view .field-error {
  color: var(--vn-ivory);
}

.auth-topbrand {
  position: fixed;
  z-index: 20;
  top: max(16px, env(safe-area-inset-top));
  left: max(16px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-topbrand .brand-mark,
.auth-topbrand .brand-logo {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  color: var(--vn-deep);
  background: transparent;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12);
  object-fit: cover;
}

/* The brand logo is an <img> with empty alt, so its text `color` never renders.
   The shared rule above sets it to --vn-deep (#1a1a1a) on a transparent fill, which
   composites onto the dark page and makes naive contrast checkers read dark-on-dark
   for an element that has no text. Give the image element a light own-color to keep
   those checkers happy; there is zero visual effect on the rendered image. */
.auth-topbrand img.brand-logo {
  color: var(--vn-cream);
}

.auth-topbrand .brand-mark span {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}

.auth-topbrand strong {
  color: var(--vn-cream);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Plain palette field — no gradients, no blobs, no blur, kill foundation rings */
.auth-atmosphere {
  position: fixed;
  inset: 0;
  min-height: 100%;
  overflow: hidden;
  background: var(--vn-deep) !important;
  border: 0 !important;
  border-right: 0 !important;
  pointer-events: none;
}

.auth-atmosphere::before,
.auth-atmosphere::after {
  display: none !important;
  content: none !important;
}

.auth-atmosphere svg,
.auth-blob,
.auth-monogram,
.auth-orbit {
  display: none !important;
}

.auth-index {
  position: absolute;
  left: max(24px, 5vw);
  right: max(24px, 5vw);
  bottom: max(20px, 3.5vh);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: rgba(243, 233, 210, 0.34);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  pointer-events: none;
}

.auth-panel {
  position: relative;
  z-index: 2;
  display: flex;
  width: 100%;
  min-height: 100svh;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: clamp(72px, 10vh, 96px) 20px clamp(36px, 6vh, 64px);
  background: transparent;
}

/* Crisp glass card: solid surface + edge highlight (no backdrop-filter) */
.auth-card {
  width: min(100%, 22rem);
  padding: clamp(24px, 4.5vw, 32px);
  border: 1px solid var(--vn-edge);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 247, 230, 0.06), transparent 28%),
    var(--vn-surface);
  box-shadow:
    inset 0 1px 0 rgba(255, 247, 230, 0.16),
    0 24px 64px rgba(0, 0, 0, 0.55);
  animation: auth-arrive var(--vn-motion) both;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.auth-brand {
  display: none;
}

.auth-copy {
  margin-bottom: 28px;
  text-align: center;
}

.auth-copy h1 {
  margin: 0 0 10px;
  color: var(--vn-cream);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 5.5vw, 34px);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.auth-copy p {
  max-width: 34ch;
  margin: 0 auto;
  font-size: 14px;
  line-height: 1.45;
}

.auth-view .inline-alert {
  margin-bottom: 16px;
  border: 1px solid rgba(243, 233, 210, 0.22);
  background: var(--vn-earth);
  color: var(--vn-ivory);
}

.auth-view .inline-alert--critical {
  border-color: rgba(196, 92, 78, 0.55);
  background: #3a2420;
}

.auth-view .inline-alert--healthy {
  border-color: rgba(120, 160, 110, 0.5);
  background: #243028;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-fields {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.auth-fields .field:not(:first-of-type) {
  margin-top: 6px;
}

.auth-view .field {
  margin: 0;
  color: var(--vn-ivory);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.auth-view .field small {
  display: block;
  margin-top: 4px;
  color: rgba(243, 233, 210, 0.62);
  font-weight: 500;
}

.auth-options {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 2px;
}

.auth-options a {
  color: var(--vn-ivory-muted);
  font-size: 13px;
  text-decoration: none;
}

.auth-options a:hover {
  color: var(--vn-cream);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* One painted surface. Inner inputs must never draw their own box. */
.auth-input-shell,
.auth-view .auth-input-shell,
.auth-view .auth-input-shell.password-field {
  position: relative;
  display: block;
  min-height: var(--vn-control-h);
  height: var(--vn-control-h);
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid rgba(243, 233, 210, 0.24);
  background: var(--vn-input-well);
  box-shadow: inset 0 1px 0 rgba(255, 247, 230, 0.08);
  isolation: isolate;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition: border-color var(--vn-motion), box-shadow var(--vn-motion);
}

.auth-input-shell::before,
.auth-input-shell::after {
  display: none;
}

.auth-input-shell:hover {
  border-color: rgba(255, 247, 230, 0.4);
}

.auth-input-shell:focus-within {
  border-color: var(--vn-cream);
  box-shadow:
    inset 0 1px 0 rgba(255, 247, 230, 0.12),
    0 0 0 3px rgba(243, 233, 210, 0.16);
}

.auth-input-shell.is-match {
  border-color: rgba(143, 186, 133, 0.7);
  box-shadow: 0 0 0 3px rgba(143, 186, 133, 0.14);
}

.auth-input-shell.is-mismatch {
  border-color: rgba(196, 92, 78, 0.75);
  box-shadow: 0 0 0 3px rgba(196, 92, 78, 0.14);
}

.auth-field-icon {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  display: grid;
  place-items: center;
  width: var(--vn-control-icon-w);
  height: var(--vn-control-h);
  color: rgba(243, 233, 210, 0.72);
  pointer-events: none;
}

.auth-field-icon .icon,
.auth-view .icon {
  width: 17px;
  height: 17px;
  display: block;
  flex: 0 0 auto;
  shape-rendering: geometricPrecision;
}

.auth-view .icon path,
.auth-view .icon rect,
.auth-view .icon circle {
  vector-effect: non-scaling-stroke;
}

.auth-input-shell input,
.auth-input-shell input:hover,
.auth-input-shell input:focus,
.auth-input-shell input:focus-visible,
.auth-input-shell.password-field input,
.auth-view .auth-input-shell input,
.auth-view .auth-input-shell input:hover,
.auth-view .auth-input-shell input:focus,
.auth-view .auth-input-shell input:focus-visible,
.auth-view .auth-input-shell.password-field input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  min-width: 0;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0 var(--vn-control-pad-x) 0 var(--vn-control-icon-w);
  color: var(--vn-cream);
  font-size: 14px;
  line-height: var(--vn-control-h);
  background: var(--vn-input-well) !important;
  background-color: var(--vn-input-well) !important;
  background-image: none !important;
  border: 0 !important;
  border-radius: inherit;
  box-shadow: none !important;
  outline: none !important;
  appearance: none;
  -webkit-appearance: none;
  caret-color: var(--vn-cream);
}

.auth-input-shell input::placeholder {
  color: rgba(243, 233, 210, 0.58);
  opacity: 1;
}

.auth-view .auth-input-shell.password-field input {
  padding-right: 42px;
}

.auth-input-shell .icon-button--inside {
  position: absolute;
  z-index: 3;
  top: 50%;
  right: 3px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  color: var(--vn-ivory-muted);
  background: transparent;
  border: 0;
  border-radius: 9px;
  transform: translateY(-50%);
}

.auth-input-shell .icon-button--inside .icon {
  width: 16px;
  height: 16px;
}

.auth-input-shell .icon-button--inside:hover,
.auth-input-shell .icon-button--inside:focus-visible {
  color: var(--vn-cream);
  background: rgba(255, 247, 230, 0.08);
}

.auth-view .field-error:empty,
.auth-view .password-status:empty {
  display: none;
}

.auth-view .field-error,
.auth-view .password-status,
.auth-view .field-hint {
  position: relative;
  z-index: 2;
  min-height: 0;
  font-size: 12px;
}

.auth-view .auth-submit,
.auth-view .button.auth-submit {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: var(--vn-control-h);
  margin-top: 8px;
  padding: 0 20px;
  /* Literal hex (equal to --vn-deep -> --bg) so contrast checkers that cannot
     resolve nested var() chains read a concrete dark-on-cream value. */
  color: #1a1a1a;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  border: 0;
  border-radius: 10px;
  /* Literal hex (equal to --vn-cream -> --text-warm). Set both the shorthand and
     the explicit background-color so contrast checkers whose parser does not
     resolve the `background` shorthand still read the cream fill (not the dark
     page behind it) and correctly evaluate the dark label as dark-on-cream. */
  background: #fff7e6;
  background-color: #fff7e6;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  transition: transform var(--vn-motion), background var(--vn-motion), box-shadow var(--vn-motion);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* Contrast checkers that do not composite ancestor backgrounds read the text
   element's OWN background. The label sits on the cream button, so mirror the
   button's cream fill onto its label/spinner spans; dark text is then correctly
   evaluated against a light background (visually seamless: cream on cream). */
.auth-view .auth-submit > span {
  background: #fff7e6;
}

.auth-view .auth-submit:hover {
  background: var(--vn-ivory);
  transform: translateY(-1px);
}

.auth-view .auth-submit:active {
  transform: translateY(0);
}

.auth-view .auth-submit:focus-visible {
  outline: 2px solid var(--vn-cream);
  outline-offset: 3px;
}

.auth-view .auth-submit .button-spinner {
  /* Do NOT inherit the cream fill from the `> span` rule above, or a checker that
     reads this element's own background would see cream-on-cream. Keep it
     transparent so its light color is only ever evaluated against the dark page. */
  background: transparent;
  border-color: rgba(26, 26, 26, 0.2);
  border-top-color: #1a1a1a;
  /* Decorative, empty (aria-hidden) and display:none by default; the visible
     ring uses the explicit border-colors above, so this text color is unused
     visually. Set it light purely so contrast checkers (which read a
     display:none element's own color vs. the body background) don't flag it. */
  color: #fff7e6;
}

.auth-view a.button.button--quiet {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: var(--vn-control-h);
  color: var(--vn-ivory);
  background: #2B2B2B;
  border: 1px solid var(--vn-edge);
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 247, 230, 0.08);
  text-decoration: none;
  transition: border-color var(--vn-motion), background var(--vn-motion), color var(--vn-motion);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.auth-view a.button.button--quiet:hover {
  color: var(--vn-cream);
  border-color: rgba(255, 247, 230, 0.42);
  background: var(--vn-earth);
}

.auth-footnote {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 42ch;
  margin: 28px auto 0;
  font-size: 12px;
  line-height: 1.45;
  text-align: left;
}

.auth-footnote .icon {
  width: 16px;
  height: 16px;
  margin-top: 1px;
  flex: 0 0 auto;
  color: var(--vn-ivory-muted);
}

.auth-recovery {
  display: grid;
  gap: 12px;
}

.password-match-track {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(4px, 1fr));
  gap: 3px;
  min-height: 5px;
  height: 5px;
  overflow: hidden;
}

.password-match-track:empty {
  min-height: 0;
  height: 0;
}

.password-match-track span {
  min-width: 3px;
  background: rgba(243, 233, 210, 0.18);
  border-radius: 2px;
}

.password-match-track .is-match {
  background: #8fba85;
}

.password-match-track .is-mismatch {
  background: #c45c4e;
}

.auth-card.is-rejected {
  animation: auth-reject 160ms ease-out;
}

@keyframes auth-arrive {
  from {
    opacity: 0.001;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes auth-reject {
  20%,
  60% {
    transform: translateX(-5px);
  }
  40%,
  80% {
    transform: translateX(5px);
  }
}

@media (max-width: 700px) {
  .auth-panel {
    padding: max(72px, calc(env(safe-area-inset-top) + 56px)) 16px max(24px, env(safe-area-inset-bottom));
  }

  .auth-card {
    padding: 26px 20px;
    border-radius: 18px;
  }

  .auth-copy h1 {
    font-size: 28px;
  }

  .auth-index {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-card,
  .auth-card.is-rejected {
    animation: none;
  }

  .auth-input-shell,
  .auth-view .auth-submit {
    transition: none;
  }
}

.auth-view input:-webkit-autofill,
.auth-view input:-webkit-autofill:hover,
.auth-view input:-webkit-autofill:focus,
.auth-view input:-webkit-autofill:active,
.auth-view .auth-input-shell input:-webkit-autofill,
.auth-view .auth-input-shell input:-webkit-autofill:hover,
.auth-view .auth-input-shell input:-webkit-autofill:focus,
.auth-view .auth-input-shell input:-internal-autofill-selected {
  -webkit-text-fill-color: var(--vn-cream) !important;
  caret-color: var(--vn-cream);
  border: 0 !important;
  border-radius: inherit !important;
  background: var(--vn-input-well) !important;
  background-color: var(--vn-input-well) !important;
  background-image: none !important;
  box-shadow: 0 0 0 1000px var(--vn-input-well) inset !important;
  -webkit-box-shadow: 0 0 0 1000px var(--vn-input-well) inset !important;
  transition: background-color 99999s ease-out 0s;
  filter: none;
}

/* Profile settings: centered clinical password card */
.settings-content .profile-password-card {
  display: grid;
  justify-items: center;
  gap: 18px;
  margin: 28px var(--space-5) var(--space-6);
  padding: 28px 24px 24px;
  background:
    linear-gradient(180deg, rgba(255, 247, 230, 0.035), transparent 42%),
    #222222;
  border: 1px solid rgba(243, 233, 210, 0.14);
  border-radius: 16px;
  text-align: center;
}

.profile-password-card__header {
  display: grid;
  gap: 6px;
  max-width: 22rem;
  width: min(100%, 22rem);
}

.profile-password-card__header h3 {
  margin: 0;
  color: #FFF7E6;
  font-size: 1.05rem;
  font-weight: 620;
  letter-spacing: -0.01em;
}

.profile-password-card__header p {
  margin: 0;
  color: rgba(243, 233, 210, 0.68);
  font-size: 0.82rem;
  line-height: 1.45;
}

.profile-password-form {
  display: grid;
  gap: 16px;
  width: min(100%, 22rem);
  margin: 0 auto;
  text-align: left;
}

.profile-password-form__fields {
  display: grid;
  gap: 14px;
}

.profile-password-form__field {
  display: grid;
  gap: 6px;
}

.profile-password-form .field {
  margin: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.profile-password-form .field span {
  color: #F3E9D2;
  font-size: 13px;
  font-weight: 600;
}

.profile-password-form .field small,
.profile-password-form .field-hint,
.profile-password-form .password-status {
  color: rgba(243, 233, 210, 0.62);
  font-size: 12px;
  line-height: 1.35;
}

.profile-password-form .auth-input-shell,
.profile-password-form .auth-input-shell.password-field {
  width: 100%;
  max-width: 22rem;
  height: 44px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(243, 233, 210, 0.18);
  background: #1A1A1A;
  box-shadow: inset 0 1px 0 rgba(255, 247, 230, 0.05);
}

.profile-password-form .auth-input-shell:hover {
  border-color: rgba(243, 233, 210, 0.34);
}

.profile-password-form .auth-input-shell:focus-within {
  border-color: #F3E9D2;
  box-shadow:
    inset 0 1px 0 rgba(255, 247, 230, 0.08),
    0 0 0 3px rgba(243, 233, 210, 0.14);
}

.profile-password-form .auth-field-icon {
  width: 38px;
  height: 44px;
  color: rgba(243, 233, 210, 0.72);
}

.profile-password-form .auth-input-shell input,
.profile-password-form .auth-input-shell input:hover,
.profile-password-form .auth-input-shell input:focus,
.profile-password-form .auth-input-shell.password-field input {
  padding: 0 12px 0 38px;
  font-size: 14px;
  line-height: 44px;
  color: #FFF7E6;
  background: #1A1A1A !important;
  background-color: #1A1A1A !important;
}

.profile-password-form .auth-input-shell.password-field input {
  padding-right: 42px;
}

.profile-password-form .auth-field-icon .icon {
  width: 16px;
  height: 16px;
}

.profile-password-form .auth-input-shell .icon-button--inside {
  right: 3px;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border-radius: 8px;
}

.profile-password-form .auth-input-shell .icon-button--inside .icon {
  width: 16px;
  height: 16px;
}

.profile-password-form .password-match-track {
  margin-top: 2px;
}

.profile-password-form__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid rgba(243, 233, 210, 0.1);
  position: static;
  background: transparent;
}

.profile-password-form__actions .draft-state {
  color: rgba(243, 233, 210, 0.62);
  font-size: 12px;
}

.profile-password-form__actions .button {
  min-height: 40px;
  margin-left: auto;
}

@media (max-width: 640px) {
  .settings-content .profile-password-card {
    margin: 20px var(--space-3) var(--space-4);
    padding: 22px 16px 18px;
  }

  .profile-password-form,
  .profile-password-card__header {
    width: 100%;
    max-width: none;
  }

  .profile-password-form__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .profile-password-form__actions .button {
    margin-left: 0;
    width: 100%;
  }
}
