/* Keep authentication feedback in a reserved slot so failed sign-in never shifts the form. */
@media (min-width: 961px) {
  body[data-page="auth"] #account-entry {
    justify-content: flex-start;
    padding-block: clamp(24px, 2vw, 34px);
  }
}

@media (min-width: 961px) and (max-height: 620px) {
  body[data-page="auth"] #account-entry {
    padding-block: 16px;
  }
}

/* Keep empty login feedback from reserving a large blank slot under the form. */
body[data-page="auth"] #login-feedback:empty {
  display: none;
  height: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
}
body[data-page="auth"] #login-feedback:not(:empty) {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  min-height: 38px;
  margin: 7px 0 0;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.35;
}

body[data-page="auth"] .auth-entry-feedback:empty { display: none; }
body[data-page="auth"] .auth-entry-feedback:not(:empty) {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  min-height: 38px;
  margin: 8px 0 0;
  padding: 7px 10px;
  font-size: 12px;
  line-height: 1.45;
}
body[data-page="auth"] .auth-login-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin: 15px 0 0;
  text-align: center;
}

/* Keep the sign-in card compact; the registration view still grows to its full form. */
body[data-page="auth"] #auth-layout:has(#login-form:not([hidden])) {
  min-height: 0;
}
body[data-page="auth"] #auth-layout:has(#login-form:not([hidden])) .public-welcome {
  min-height: 0;
}

body[data-page="auth"] .aid-password-reset-dialog {
  box-sizing: border-box;
  width: min(460px, calc(100vw - 32px));
  max-width: 460px;
  max-height: min(88vh, 620px);
  overflow: auto;
  color: var(--ink);
}
body[data-page="auth"] .aid-password-reset-dialog::backdrop { background: rgba(4,12,26,.62); backdrop-filter: blur(4px); }
body[data-page="auth"] .aid-password-reset-dialog h2 { margin: 0 0 10px; }
body[data-page="auth"] .aid-password-reset-dialog p { line-height: 1.6; }
body[data-page="auth"] .aid-password-reset-dialog .actions { justify-content: flex-end; }

/* Let the auth card grow to its content height; short windows scroll the page. */
@media (min-width: 961px) {
  body[data-page="auth"] .auth-main {
    height: auto;
    min-height: calc(100svh - 64px);
    justify-content: flex-start;
    overflow: visible;
    padding-block: 12px 16px;
  }
  body[data-page="auth"] .login-layout {
    height: auto;
    min-height: max-content;
    overflow: hidden;
  }
  body[data-page="auth"] .public-welcome { min-height: 540px; }
  body[data-page="auth"] #account-entry,
  body[data-page="auth"] .auth-grid > .panel {
    min-height: max-content;
  }
  body[data-page="auth"] .auth-grid > .panel { flex: 0 0 auto; }
}
@media (max-width: 960px) {
  body[data-page="auth"] .login-layout {
    height: auto;
    min-height: max-content;
    overflow: hidden;
  }
  body[data-page="auth"] #account-entry,
  body[data-page="auth"] .auth-grid > .panel {
    min-height: max-content;
  }
  body[data-page="auth"] .auth-grid > .panel { flex: 0 0 auto; }
}

/* Match the authenticated workspace's compact paired sun/moon control. */
body[data-page="auth"] #theme-toggle.theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 72px;
  padding: 7px 10px;
  font-size: 16px;
  line-height: 1;
  letter-spacing: .01em;
}

body[data-page="auth"] #theme-toggle .theme-divider { color: var(--muted); font-size: 12px; }
body[data-page="auth"] #theme-toggle .theme-sun,
body[data-page="auth"] #theme-toggle .theme-moon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
