/* ==========================================================================
   Messages (EF3): inline alerts in auth/form cards, toasts elsewhere,
   field errors. Markup: templates/partials/messages.html; behaviour:
   static/messages.js. Self-contained colours so the admin can use it too.
   ========================================================================== */
.qs-alert,.qs-toast{
  --m-bg:#E8F2F4;--m-line:rgba(43,122,140,.22);--m-ink:#1D4B57;--m-dot:#2B7A8C;--m-dot-ink:#fff;
  display:flex;align-items:flex-start;gap:12px;
  background:var(--m-bg);border:1px solid var(--m-line);color:var(--m-ink);
  border-radius:14px;padding:12px 12px 12px 12px;
  font-size:14px;line-height:1.45;text-align:left;
}
.qs-alert-error,.qs-toast-error{--m-bg:#FCEEE9;--m-line:rgba(192,80,58,.26);--m-ink:#7E2F1F;--m-dot:#D0614A;}
.qs-alert-success,.qs-toast-success{--m-bg:#E7F4EE;--m-line:rgba(31,128,104,.24);--m-ink:#14493F;--m-dot:#2A9478;}
.qs-alert-warning,.qs-toast-warning{--m-bg:#FBF3DF;--m-line:rgba(217,168,69,.42);--m-ink:#6A4818;--m-dot:#D9A845;--m-dot-ink:#4A3108;}
.qs-alert-info,.qs-toast-info{--m-bg:#E8F2F4;--m-line:rgba(43,122,140,.22);--m-ink:#1D4B57;--m-dot:#3A8797;}

.qs-msg-icon{
  flex:0 0 28px;width:28px;height:28px;border-radius:50%;
  display:inline-flex;align-items:center;justify-content:center;
  background:var(--m-dot);color:var(--m-dot-ink);
  box-shadow:0 0 0 4px color-mix(in srgb, var(--m-dot) 16%, transparent);
  margin-top:-2px;
}
.qs-msg-icon svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2.6;stroke-linecap:round;stroke-linejoin:round;}
.qs-msg-text{flex:1 1 auto;margin:2px 0 0;min-width:0;overflow-wrap:anywhere;font-weight:500;}
.qs-msg-text b,.qs-msg-text strong{font-weight:700;}
.qs-msg-close{
  flex:0 0 28px;width:28px;height:28px;margin:-3px -3px 0 0;padding:0;border:0;border-radius:9px;
  background:transparent;color:inherit;opacity:.55;cursor:pointer;
  display:inline-flex;align-items:center;justify-content:center;
  transition:opacity .15s, background-color .15s;
}
.qs-msg-close:hover{opacity:1;background:color-mix(in srgb, var(--m-dot) 14%, transparent);}
.qs-msg-close:focus-visible{outline:2px solid var(--m-dot);outline-offset:1px;opacity:1;}
.qs-msg-close svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;}
/* Without JS a close button cannot work: hide it. */
html:not(.js) .qs-msg-close{display:none;}

.qs-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;}

/* ---- Inline alerts (inside .auth-card) ---------------------------------- */
.qs-alerts{display:flex;flex-direction:column;gap:10px;margin:0 0 20px;}
.auth-card > .qs-alert{margin:0 0 16px;}
.auth-card-center .qs-alerts{margin:0 0 16px;}
.js .qs-alert{animation:qs-alert-in .32s cubic-bezier(.2,.8,.2,1) both;}
.qs-alert.is-leaving{animation:qs-fade-out .2s ease forwards;}
@keyframes qs-alert-in{from{opacity:0;transform:translateY(-6px);}to{opacity:1;transform:none;}}
@keyframes qs-fade-out{to{opacity:0;transform:translateY(-4px);}}

/* ---- Toasts -------------------------------------------------------------- */
/* No JS: a static list at the top of the page content. */
.qs-toasts{display:flex;flex-direction:column;gap:10px;margin:0 0 20px;}
.qs-toast{position:relative;overflow:hidden;}
.js .qs-toasts{
  position:fixed;z-index:1200;top:20px;right:20px;margin:0;
  width:min(380px, calc(100vw - 32px));pointer-events:none;
}
.js .qs-toast{
  pointer-events:auto;
  background:color-mix(in srgb, var(--m-bg) 94%, #fff);
  box-shadow:0 18px 40px -18px rgba(11,40,44,.35), 0 2px 6px rgba(11,40,44,.08);
  padding:14px 12px 14px 14px;
  animation:qs-toast-in .38s cubic-bezier(.2,.8,.2,1) both;
}
.js .qs-toast.is-leaving{animation:qs-toast-out .26s ease forwards;}
@keyframes qs-toast-in{from{opacity:0;transform:translateX(24px) scale(.98);}to{opacity:1;transform:none;}}
@keyframes qs-toast-out{to{opacity:0;transform:translateX(24px) scale(.98);}}
.qs-toast-timer{
  position:absolute;left:0;bottom:0;height:3px;width:100%;
  background:var(--m-dot);opacity:.45;transform-origin:left;transform:scaleX(0);
}
.js .qs-toast-timer{transform:scaleX(1);}
.qs-toast.is-timing .qs-toast-timer{animation:qs-timer var(--qs-toast-ms,5000ms) linear forwards;}
.qs-toast.is-paused .qs-toast-timer{animation-play-state:paused;}
@keyframes qs-timer{from{transform:scaleX(1);}to{transform:scaleX(0);}}

@media (max-width:640px){
  .js .qs-toasts{top:12px;right:auto;left:50%;transform:translateX(-50%);width:calc(100vw - 24px);}
  @keyframes qs-toast-in{from{opacity:0;transform:translateY(-16px);}to{opacity:1;transform:none;}}
  @keyframes qs-toast-out{to{opacity:0;transform:translateY(-16px);}}
}

/* ---- Field errors -------------------------------------------------------- */
.field-error{
  display:flex;align-items:flex-start;gap:6px;
  font-size:12.5px;line-height:1.4;color:#A63E29;font-weight:500;margin-top:7px;
}
.field-error::before{
  content:"!";flex:0 0 16px;width:16px;height:16px;border-radius:50%;
  background:#D0614A;color:#fff;font-size:11px;font-weight:800;line-height:16px;text-align:center;
  margin-top:0;
}
.field-error-consent{margin:-8px 0 14px;}
html body .field .input[aria-invalid="true"],
html body .input[aria-invalid="true"]{
  border-color:#D98472;background:#FFF8F6;
}
html body .field .input[aria-invalid="true"]:focus,
html body .input[aria-invalid="true"]:focus{
  border-color:#C0503A;background:#fff;box-shadow:0 0 0 4px rgba(208,97,74,.16);
}
/* Failed login: both fields softly tinted — the page does not say which one. */
html body .field .input.is-soft-invalid[aria-invalid="true"]{border-color:rgba(208,97,74,.5);background:#FFFBFA;}

/* ---- Failed login: one subtle shake ------------------------------------- */
.auth-card.is-shake{animation:qs-shake .5s cubic-bezier(.36,.07,.19,.97) both;}
@keyframes qs-shake{
  10%,90%{transform:translateX(-1px);}
  20%,80%{transform:translateX(3px);}
  30%,50%,70%{transform:translateX(-5px);}
  40%,60%{transform:translateX(5px);}
}

@media (prefers-reduced-motion: reduce){
  .js .qs-alert,.js .qs-toast,.qs-alert.is-leaving,.js .qs-toast.is-leaving,.auth-card.is-shake{animation:none;}
  .qs-toast.is-timing .qs-toast-timer{animation:none;display:none;}
  .qs-msg-close{transition:none;}
}

/* ---- Login: «Запомнить меня» + «Забыли пароль?» row ---------------------- */
.login-options{display:flex;align-items:center;justify-content:space-between;gap:10px 16px;flex-wrap:wrap;margin:-4px 0 20px;}
.login-options .forgot-link{margin:0;min-height:0;}
.remember-line{position:relative;display:inline-flex;align-items:flex-start;gap:10px;cursor:pointer;user-select:none;}
.remember-box{position:absolute;opacity:0;width:22px;height:22px;margin:0;cursor:pointer;}
.remember-mark{flex:0 0 22px;width:22px;height:22px;border-radius:7px;border:1.5px solid #B9CFCB;background:#fff;
  display:inline-flex;align-items:center;justify-content:center;transition:background-color .15s,border-color .15s,box-shadow .15s;}
.remember-mark svg{width:15px;height:15px;fill:none;stroke:#fff;stroke-width:2.8;stroke-linecap:round;stroke-linejoin:round;opacity:0;transform:scale(.6);transition:opacity .15s,transform .15s;}
.remember-box:checked + .remember-mark{background:#0B4A4F;border-color:#0B4A4F;}
.remember-box:checked + .remember-mark svg{opacity:1;transform:none;}
.remember-box:focus-visible + .remember-mark{box-shadow:0 0 0 4px rgba(43,122,140,.22);border-color:#0B4A4F;}
.remember-line:hover .remember-mark{border-color:#0B4A4F;}
.remember-text{display:flex;flex-direction:column;font-size:14px;font-weight:600;line-height:1.25;color:#173F42;padding-top:1px;}
.remember-text small{font-size:12px;font-weight:500;color:#6E8584;margin-top:2px;}
@media (prefers-reduced-motion: reduce){.remember-mark,.remember-mark svg{transition:none;}}
