/* Authentication is isolated from the ordinary workspace by the caller. */
body.auth-mode {
  background: #edf1f6;
}

body.auth-mode .shell {
  display: block;
  min-height: 100dvh;
}

body.auth-mode .shell .sidebar,
body.auth-mode .topbar,
body.auth-mode .account-control,
body.auth-mode .account-trigger,
body.auth-mode .account-dialog,
body.auth-mode > .skip-link {
  display: none !important;
}

body.auth-mode .app-body {
  margin: 0;
  min-width: 0;
}

body.auth-mode #main {
  min-height: 100dvh;
  padding: 0;
}

.auth-page {
  --auth-ink: #20003f;
  --auth-muted: #715e83;
  --auth-line: #e3dfe9;
  box-sizing: border-box;
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: max(40px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(40px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  color: var(--auth-ink);
  background: radial-gradient(ellipse at 17% 12%, #e5effa 0, transparent 48%), radial-gradient(ellipse at 86% 86%, #e8f6ef 0, transparent 43%), #f2f4f8;
  font-family: Montserrat, 'Segoe UI', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

.auth-page *,
.auth-page *::before,
.auth-page *::after {
  box-sizing: border-box;
}

.auth-card {
  width: min(100%, 452px);
  min-width: 0;
  padding: 34px;
  border: 1px solid #ffffff;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 14px 50px #20003f08, 0 2px 7px #20003f04;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 31px;
  color: var(--auth-ink);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.55px;
  line-height: 1.4;
}

.auth-brand img {
  display: block;
  width: 36px;
  height: 36px;
  flex: none;
}

.auth-card .auth-title {
  margin: 0;
  color: var(--auth-ink);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -.8px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.auth-title:focus {
  outline: none;
}

.auth-card .auth-description {
  margin: 10px 0 25px;
  color: var(--auth-muted);
  font-size: 14px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.auth-form {
  display: grid;
  gap: 19px;
  margin: 0;
}

.auth-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.auth-field > label {
  color: var(--auth-ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}

.auth-input-wrap {
  position: relative;
  min-width: 0;
}

.auth-page .auth-input {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid #ded8e6;
  border-radius: 10px;
  background: #fff;
  color: var(--auth-ink);
  font: inherit;
  font-size: 16px;
  line-height: 1.45;
  transition: border-color .15s, box-shadow .15s;
}

.auth-page .auth-input:hover:not(:disabled) {
  border-color: #bdaec9;
}

.auth-page .auth-input:focus {
  border-color: #9d83b5;
  outline: 2px solid #c8b6d9;
  outline-offset: 2px;
}

.auth-page .auth-input[aria-invalid='true'] {
  border-color: #b75570;
}

.auth-password-wrap .auth-input {
  padding-right: 77px;
}

.auth-page .auth-password-toggle {
  position: absolute;
  top: 2px;
  right: 3px;
  min-width: 61px;
  min-height: 44px;
  padding: 8px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #4c3564;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.auth-password-toggle:hover:not(:disabled) {
  background: #f4f0f8;
}

.auth-card .auth-field-hint,
.auth-card .auth-field-error {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.auth-field-hint {
  color: var(--auth-muted);
}

.auth-field-error {
  color: #a32643;
}

.auth-recovery {
  display: flex;
  justify-content: flex-end;
  margin: -8px 0 -5px;
}

.auth-page .auth-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 12px 17px;
  border: 1px solid var(--auth-line);
  border-radius: 10px;
  color: var(--auth-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  text-align: center;
  white-space: normal;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}

.auth-page .auth-primary {
  border-color: #61dfae;
  background: linear-gradient(145deg, #8af8cc, #73f4c0);
  box-shadow: 0 1px 2px #20003f08;
}

.auth-primary:hover:not(:disabled) {
  border-color: #50dca4;
  background: #60eab1;
}

.auth-primary:active:not(:disabled) {
  background: #4bd89e;
}

.auth-secondary {
  background: #fff;
}

.auth-secondary:hover:not(:disabled) {
  border-color: #c6b9d2;
  background: #f6f8fb;
}

.auth-page .auth-link {
  min-height: 44px;
  padding: 8px 3px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #4c3564;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.6;
  text-align: center;
  white-space: normal;
  cursor: pointer;
}

.auth-link:hover:not(:disabled) {
  color: var(--auth-ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.auth-page button:focus-visible,
.auth-error:focus {
  outline: 2px solid #9d83b5;
  outline-offset: 3px;
}

.auth-page button:disabled,
.auth-page input:disabled {
  cursor: wait;
  opacity: .65;
}

.auth-page .auth-primary:disabled {
  border-color: #ded8e6;
  background: #eef0f3;
  color: #715e83;
  box-shadow: none;
}

.auth-actions {
  display: grid;
  gap: 11px;
}

.auth-card .auth-notice,
.auth-card .auth-error {
  margin: 0 0 22px;
  padding: 12px 14px;
  border: 1px solid #d9cfe5;
  border-radius: 9px;
  background: #f7f4fb;
  color: #4c3564;
  font-size: 14px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.auth-card .auth-error {
  border-color: #efd1db;
  background: #fff3f5;
  color: #a32643;
}

.auth-card .auth-status {
  margin: 12px 0 0;
  color: var(--auth-muted);
  font-size: 12px;
  line-height: 1.6;
}

.auth-status:empty {
  display: none;
}

.auth-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0 7px;
  margin-top: 24px;
  padding-top: 19px;
  border-top: 1px solid #eeeaf2;
  color: var(--auth-muted);
  font-size: 14px;
  line-height: 1.7;
  text-align: center;
}

.auth-footer .auth-link {
  max-width: 100%;
}

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

@media (max-width: 480px) {
  .auth-page {
    padding: max(22px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(22px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }

  .auth-card {
    padding: 27px 24px;
    border-radius: 16px;
  }

  .auth-brand {
    margin-bottom: 27px;
    font-size: 16px;
  }

  .auth-card .auth-title {
    font-size: 26px;
    letter-spacing: -.65px;
  }

  .auth-card .auth-description {
    margin-bottom: 23px;
  }

  .auth-footer {
    margin-top: 22px;
    padding-top: 16px;
  }
}

@media (max-width: 350px) {
  .auth-card {
    padding: 25px 20px;
  }

  .auth-card .auth-title {
    font-size: 25px;
  }

  .auth-footer {
    flex-direction: column;
    gap: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-page *,
  .auth-page *::before,
  .auth-page *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
