/* The public login and signup routes share one focused account form. */
body.cm-auth-entry {
  background: var(--dt-color-surface-muted);
  color: var(--dt-color-text);
  overflow-x: hidden;
  overflow-y: auto;
}

body.cm-auth-entry .auth-popup-container {
  min-height: calc(100dvh - var(--cm-header-height, 60px) - var(--cm-auth-footer-offset));
  padding: clamp(24px, 5vw, 72px) 20px !important;
  background: var(--dt-color-surface-muted);
  background-image: none !important;
}

body.cm-auth-entry .auth-popup-shell {
  width: 100%;
  max-width: 520px;
  min-height: 0;
  height: auto;
  margin: auto;
  display: block;
  overflow: visible;
  background: transparent;
}

body.cm-auth-entry .auth-popup-story { display: none; }

body.cm-auth-entry .auth-popup-card {
  width: 100%;
  max-width: none;
  min-height: 0;
  padding: clamp(26px, 4vw, 42px) !important;
  display: block;
  overflow: visible;
  border: 1px solid var(--dt-color-border);
  border-radius: var(--dt-radius-lg);
  background: var(--dt-color-surface);
  box-shadow: none;
}

body.cm-auth-entry .auth-popup-card > :where(h1, .auth-sub, .auth-role-field, .auth-workspace-field, #maintenance-banner, #reset-success-banner, .auth-error, .auth-google-wrap, .auth-google-note, .auth-divider, form, .auth-footer, #tfa-screen) {
  width: 100%;
  max-width: none;
}

body.cm-auth-entry .auth-box h1 {
  font-family: var(--dt-font-editorial);
  font-size: clamp(28px, 3vw, 36px);
  line-height: 1.15;
  letter-spacing: -.035em;
  color: var(--dt-color-text);
}

body.cm-auth-entry .auth-box .auth-sub {
  margin: 8px auto 28px;
  color: var(--dt-color-text-muted);
  font-size: var(--dt-text-base);
  line-height: 1.5;
}

body.cm-auth-entry .dt-workspace-switcher__menu[hidden],
body.cm-auth-entry .dt-workspace-switcher__option i[hidden] {
  display: none;
}

body.cm-auth-entry .auth-workspace-field { margin-bottom: 24px; }

body.cm-auth-entry .auth-role-field.dt-select-field {
  min-width: 0;
  margin-bottom: 24px;
  gap: 7px;
}

body.cm-auth-entry .auth-role-field .dt-select-field__label {
  margin: 0;
  color: var(--dt-color-text-muted);
  font: var(--dt-weight-semibold) var(--dt-text-sm) var(--dt-font-compact);
  letter-spacing: 0;
  text-transform: none;
}

body.cm-auth-entry .auth-role-field .dt-select-field__control {
  min-height: var(--dt-control-height-lg);
}

html[data-cm-density] body.cm-auth-entry .auth-role-field .dt-select-field__control select {
  min-height: calc(var(--dt-control-height-lg) - 2px);
  border: 0;
  border-radius: var(--dt-radius-sm);
  background: transparent;
  color: var(--dt-color-text);
  font: var(--dt-text-base) var(--dt-font-interface);
}

body.cm-auth-entry .auth-popup-card #signup-form .form-row {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

body.cm-auth-entry .form-group.dt-field {
  width: 100%;
  min-width: 0;
  gap: 7px;
  margin-bottom: 18px;
}

body.cm-auth-entry .form-group.dt-field > .dt-field__label {
  margin: 0;
  color: var(--dt-color-text-muted);
  font: var(--dt-weight-semibold) var(--dt-text-sm) var(--dt-font-compact);
  letter-spacing: 0;
  text-transform: none;
}

body.cm-auth-entry .form-group.dt-field > .dt-field__control {
  border: 1px solid var(--dt-color-border);
  border-radius: var(--dt-radius-sm);
  background: var(--dt-color-surface);
  min-height: var(--dt-control-height-lg);
}

body.cm-auth-entry .form-group.dt-field > .dt-field__control:focus-within {
  border-color: var(--dt-color-brand);
  box-shadow: 0 0 0 3px var(--dt-color-focus);
}

html[data-cm-density] body.cm-auth-entry .form-group.dt-field > .dt-field__control input {
  width: 100%;
  min-height: 0 !important;
  border: 0;
  border-radius: 0 !important;
  padding: 12px 14px;
  background: transparent;
  color: var(--dt-color-text);
  box-shadow: none;
  font: var(--dt-text-base) var(--dt-font-interface);
}

body.cm-auth-entry .terms-accept.dt-check {
  display: inline-flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  margin: 2px 0 20px;
  color: var(--dt-color-text);
  font-size: var(--dt-text-sm);
}

body.cm-auth-entry .terms-accept.dt-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

body.cm-auth-entry .terms-accept.dt-check .dt-check__box {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

body.cm-auth-entry .terms-accept.dt-check .dt-choice-copy {
  display: block;
  line-height: 1.45;
}

body.cm-auth-entry .terms-accept.dt-check .dt-choice-copy small {
  display: block;
  margin-top: 2px;
  color: var(--dt-color-text-muted);
  font-size: var(--dt-text-xs);
}

body.cm-auth-entry .terms-accept a,
body.cm-auth-entry .auth-footer a { color: var(--dt-color-brand); }

body.cm-auth-entry .auth-box form > .auth-submit {
  width: 100%;
  margin-top: 4px;
  font-weight: var(--dt-weight-semibold);
}

body.cm-auth-entry .auth-captcha {
  margin: 4px 0 18px;
  padding-top: 18px;
  border-top: 1px solid var(--dt-color-border);
}

body.cm-auth-entry .auth-captcha-heading.dt-section-heading {
  display: block;
  margin-bottom: 12px;
}

body.cm-auth-entry .auth-captcha-heading.dt-section-heading h2 {
  margin: 0;
  color: var(--dt-color-text);
  font-size: var(--dt-text-lg);
  font-weight: var(--dt-weight-semibold);
  line-height: 1.35;
}

body.cm-auth-entry .auth-captcha-heading.dt-section-heading p {
  margin: 3px 0 0;
  color: var(--dt-color-text-muted);
  font-size: var(--dt-text-sm);
}

body.cm-auth-entry .auth-captcha-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

body.cm-auth-entry .auth-captcha-visual {
  min-height: 72px;
  padding: 7px 9px;
  gap: 10px;
  border: 1px solid var(--dt-color-border);
  border-radius: var(--dt-radius-sm) !important;
  background: var(--dt-color-surface-muted);
}

body.cm-auth-entry .auth-captcha-visual img {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  height: 56px;
  object-fit: contain;
  object-position: left center;
}

body.cm-auth-entry .auth-captcha-refresh.dt-icon-button {
  flex: 0 0 var(--dt-control-height);
  width: var(--dt-control-height);
  height: var(--dt-control-height);
  min-height: var(--dt-control-height);
  padding: 0;
  border: 1px solid var(--dt-color-border);
  border-radius: var(--dt-radius-sm) !important;
  background: var(--dt-color-surface);
  color: var(--dt-color-text-muted);
}

body.cm-auth-entry .auth-captcha-refresh.dt-icon-button:hover,
body.cm-auth-entry .auth-captcha-refresh.dt-icon-button:focus-visible {
  border-color: var(--dt-color-brand);
  color: var(--dt-color-brand);
}

body.cm-auth-entry .auth-captcha-answer.dt-field {
  display: grid;
  gap: 7px;
  margin: 0;
}

body.cm-auth-entry .auth-captcha-answer.dt-field .dt-field__label {
  margin: 0;
  color: var(--dt-color-text-muted);
  font: var(--dt-weight-semibold) var(--dt-text-sm) var(--dt-font-compact);
  letter-spacing: 0;
  text-transform: none;
}

body.cm-auth-entry .auth-captcha-answer.dt-field .dt-field__control {
  min-height: var(--dt-control-height-lg);
  border: 1px solid var(--dt-color-border);
  border-radius: var(--dt-radius-sm);
  background: var(--dt-color-surface);
}

body.cm-auth-entry .auth-captcha-answer.dt-field .dt-field__control:focus-within {
  border-color: var(--dt-color-brand);
  box-shadow: 0 0 0 3px var(--dt-color-focus);
}

body.cm-auth-entry .auth-captcha-answer.dt-field .dt-field__control input {
  min-height: calc(var(--dt-control-height-lg) - 2px);
  height: auto;
  padding: 12px 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--dt-color-text);
  font: var(--dt-text-base) var(--dt-font-interface);
  font-weight: var(--dt-weight-semibold);
  letter-spacing: .14em;
  text-align: left;
  text-transform: uppercase;
}

body.cm-auth-entry #tfa-screen h1 {
  margin: 0;
  text-align: left;
}

body.cm-auth-entry #tfa-screen > .auth-sub {
  margin: 8px 0 28px;
  text-align: left;
}

body.cm-auth-entry #tfa-code-group.dt-verification-field,
body.cm-auth-entry #tfa-backup-group.dt-field {
  width: 100%;
  margin-bottom: 22px;
}

body.cm-auth-entry #tfa-code-group.dt-verification-field > label,
body.cm-auth-entry #tfa-backup-group.dt-field > .dt-field__label {
  color: var(--dt-color-text-muted);
  font: var(--dt-weight-semibold) var(--dt-text-sm) var(--dt-font-compact);
}

body.cm-auth-entry #tfa-code-group.dt-verification-field input {
  box-sizing: border-box;
  max-width: 100%;
  width: 100%;
  min-height: var(--dt-control-height-lg);
  border-color: var(--dt-color-border);
  font-size: var(--dt-text-lg);
  font-weight: var(--dt-weight-semibold);
  letter-spacing: .16em;
}

body.cm-auth-entry #tfa-code-group.dt-verification-field input[aria-invalid="true"],
body.cm-auth-entry #tfa-backup-group.dt-field:has(input[aria-invalid="true"]) .dt-field__control {
  border-color: var(--dt-color-danger);
}

body.cm-auth-entry #tfa-backup-group.dt-field .dt-field__control {
  min-height: var(--dt-control-height-lg);
  border-color: var(--dt-color-border);
}

body.cm-auth-entry #tfa-backup-group.dt-field .dt-field__control input {
  min-height: calc(var(--dt-control-height-lg) - 2px);
  border: 0;
  background: transparent;
  font: var(--dt-text-base) var(--dt-font-interface);
  letter-spacing: .08em;
}

body.cm-auth-entry .auth-tfa-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
}

body.cm-auth-entry .auth-tfa-links .dt-button {
  min-height: var(--dt-control-height-sm);
}

body.cm-auth-entry .auth-footer {
  color: var(--dt-color-text-muted);
  font-size: var(--dt-text-sm);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.5;
  text-transform: none;
}

body.cm-auth-entry .auth-footer a { font-weight: var(--dt-weight-semibold); }

@media (min-width: 921px) {
  html body.auth-page.cm-auth-entry.cm-fixed-header-ready > .auth-container.auth-popup-container {
    min-height: calc(100dvh - var(--cm-header-height, 60px) - var(--cm-auth-footer-offset)) !important;
    height: auto !important;
    padding: clamp(24px, 5vw, 72px) 20px !important;
  }

  html body.auth-page.cm-auth-entry.cm-fixed-header-ready > .auth-container.auth-popup-container > .auth-popup-shell {
    width: 100% !important;
    max-width: 520px !important;
    min-height: 0 !important;
    height: auto !important;
  }
}

@media (max-width: 640px) {
  body.cm-auth-entry .auth-popup-container { padding: 16px !important; }
  body.cm-auth-entry .auth-popup-card { padding: 24px 20px !important; }
  body.cm-auth-entry .auth-captcha-row { grid-template-columns: minmax(0, 1fr); }
  body.cm-auth-entry .auth-tfa-links { align-items: flex-start; flex-direction: column; }
}
