
(function(){
  window.xcvpnCopy = window.xcvpnCopy || function(text){
    if(navigator.clipboard){navigator.clipboard.writeText(text);return;}
    var t=document.createElement('textarea');t.value=text;document.body.appendChild(t);t.select();document.execCommand('copy');t.remove();
  };
  document.addEventListener('DOMContentLoaded', function(){
    document.querySelectorAll('input[name*="expiry"], input[id*="expiry"], input[name*="expire"], input[id*="expire"]').forEach(function(el){
      el.type='date'; 
      var d = new Date();
      d.setFullYear(d.getFullYear() + 15);
      var max = d.toISOString().slice(0,10);
      el.max = max;
      if(!el.value || el.value === '0000-00-00') el.value = el.max;
    });
  });
})();
