.password-visibility-field {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-width: 0;
  min-height: 43px;
  border: 1px solid var(--line, #33404c);
  border-radius: var(--password-radius, 11px);
  background: var(--input, var(--bg, #09131c));
  color: var(--ink, var(--text, #f5f7f8));
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.password-visibility-field > input[data-password-visibility] {
  grid-column: 1;
  grid-row: 1;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  margin: 0 !important;
  border: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  color: inherit;
  padding-right: 10px !important;
}

.auth-card .password-visibility-field { --password-radius: 12px; }
.portal-password-form .password-visibility-field { --password-radius: 9px; }

/* Preserve the spacing of the compact authentication forms.  Portal forms
   already use a grid gap, so adding an extra margin there would make the
   fields look unnecessarily separated. */
.auth-card input + .password-visibility-field,
.auth-card .password-visibility-field + .password-visibility-field {
  margin-top: 10px;
}

.password-visibility-field > button.password-visibility-toggle {
  grid-column: 2;
  grid-row: 1;
  position: static;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  margin: 0 3px 0 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted, #a8bac8);
  font: inherit;
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
  cursor: pointer;
}

.password-visibility-field:focus-within {
  border-color: var(--red, #f21846);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--red, #f21846) 16%, transparent);
}

.password-visibility-field > button.password-visibility-toggle:hover,
.password-visibility-field > button.password-visibility-toggle:focus-visible {
  background: color-mix(in srgb, var(--red, #f21846) 13%, transparent);
  color: inherit;
}

.password-visibility-field > button.password-visibility-toggle:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -5px;
}
.password-visibility-toggle svg { width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.password-visibility-toggle .password-eye-slash { display:none; }
.password-visibility-toggle[aria-pressed="true"] .password-eye-slash { display:block; }

.password-visibility-field:focus-within .password-visibility-toggle {
  color: var(--red, #f21846);
}

/* Keep the control usable in compact cards and on small screens without
   placing the action on top of the text the user is typing. */

@media (prefers-reduced-motion: no-preference) {
  .password-visibility-toggle { transition: background .18s ease, color .18s ease, border-color .18s ease; }
}
