.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
  background: var(--bg, #f7f5f8);
  background-image: var(--bg-grad);
  opacity: 0;
  transition: opacity 0.2s ease;
  overflow: auto;
  font-family: var(--font, system-ui, sans-serif);
  color: var(--text, #39343f);
}
.auth-gate.is-visible {
  opacity: 1;
}

.auth-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.auth-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.5;
}
.auth-blob-1 {
  width: 380px;
  height: 380px;
  top: -120px;
  left: -80px;
  background: var(--accent-soft, #efeaf9);
}
.auth-blob-2 {
  width: 320px;
  height: 320px;
  right: -100px;
  bottom: -120px;
  background: var(--pink-soft, #fbebf1);
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 396px;
  background: var(--surface, #fff);
  border: 1px solid var(--line, #ebe5f1);
  border-radius: 20px;
  padding: 26px 24px 22px;
  box-shadow: var(--shadow-lift, 0 20px 40px -22px rgba(58, 48, 82, 0.3));
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.auth-logo {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 19px;
  font-weight: 640;
  color: var(--accent-ink, #6b57a6);
  background: var(--accent-soft, #efeaf9);
  border: 1px solid var(--accent-ring, rgba(155, 138, 208, 0.32));
}
.auth-brand-text h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 680;
  letter-spacing: 0.01em;
}
.auth-brand-text p {
  margin: 2px 0 0;
  font-size: var(--fs-xs, 11px);
  color: var(--text-3, #9d97a9);
}

.auth-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 18px;
  background: var(--surface-2, #f6f3f9);
  border-radius: 12px;
}
.auth-tab {
  flex: 1 1 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2, #6d687a);
  font-family: inherit;
  font-size: var(--fs-sm, 12px);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.auth-tab:hover {
  color: var(--text, #39343f);
}
.auth-tab.is-active {
  background: var(--surface, #fff);
  color: var(--accent-ink, #6b57a6);
  box-shadow: var(--shadow, 0 1px 2px rgba(58, 48, 82, 0.04));
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auth-field[hidden] {
  display: none;
}
.auth-label {
  font-size: var(--fs-xs, 11px);
  font-weight: 600;
  color: var(--text-2, #6d687a);
}
.auth-field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line, #ebe5f1);
  border-radius: 11px;
  background: var(--surface-2, #f6f3f9);
  color: var(--text, #39343f);
  font-family: inherit;
  font-size: var(--fs, 13.5px);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.auth-field input::placeholder {
  color: var(--text-3, #9d97a9);
}
.auth-field input:focus {
  outline: none;
  background: var(--surface, #fff);
  border-color: var(--accent-2, #b7a8e2);
  box-shadow: 0 0 0 3px var(--accent-ring, rgba(155, 138, 208, 0.32));
}

.auth-input-wrap {
  position: relative;
  display: block;
}
.auth-input-wrap input {
  padding-right: 58px;
}
.auth-eye {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  padding: 4px 7px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-3, #9d97a9);
  font-family: inherit;
  font-size: var(--fs-xs, 11px);
  font-weight: 600;
  cursor: pointer;
}
.auth-eye:hover {
  color: var(--accent-ink, #6b57a6);
  background: var(--accent-soft, #efeaf9);
}

.auth-error {
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--danger-soft, #fbedf0);
  border: 1px solid rgba(207, 133, 143, 0.28);
  color: var(--danger, #cf858f);
  font-size: var(--fs-sm, 12px);
  font-weight: 550;
  line-height: 1.45;
}
.auth-error[hidden] {
  display: none;
}

.auth-submit {
  margin-top: 3px;
  padding: 11px 14px;
  border: 0;
  border-radius: 12px;
  background: var(--accent, #9b8ad0);
  color: #fff;
  font-family: inherit;
  font-size: var(--fs, 13.5px);
  font-weight: 640;
  cursor: pointer;
  transition: filter 0.18s ease, transform 0.12s ease;
}
.auth-submit:hover {
  filter: brightness(1.04);
}
.auth-submit:active {
  transform: translateY(1px);
}
.auth-submit:disabled,
.auth-submit.is-busy {
  opacity: 0.7;
  cursor: progress;
}

.auth-foot {
  margin: 16px 0 0;
  font-size: var(--fs-xs, 11px);
  line-height: 1.6;
  color: var(--text-3, #9d97a9);
  text-align: center;
}

.boot-splash-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  max-width: 280px;
  padding: 28px 24px;
}
.boot-splash-card p {
  margin: 0;
  color: var(--text-2, #6d687a);
  font-size: var(--fs-sm, 12px);
  font-weight: 550;
}

.acct {
  position: relative;
  margin-left: 4px;
}
.acct-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 9px 4px 4px;
  border: 1px solid var(--line, #ebe5f1);
  border-radius: 999px;
  background: var(--surface, #fff);
  color: var(--text-2, #6d687a);
  font-family: inherit;
  font-size: var(--fs-sm, 12px);
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.acct-btn:hover {
  border-color: var(--accent-2, #b7a8e2);
  box-shadow: 0 0 0 3px var(--accent-ring, rgba(155, 138, 208, 0.32));
}
.acct-avatar {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-ink, #6b57a6);
  background: var(--accent-soft, #efeaf9);
}
.acct-name {
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.acct-caret {
  width: 0;
  height: 0;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  border-top: 4px solid currentColor;
  opacity: 0.6;
}
.acct-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  min-width: 208px;
  padding: 8px;
  border: 1px solid var(--line, #ebe5f1);
  border-radius: 14px;
  background: var(--surface, #fff);
  box-shadow: var(--shadow-lift, 0 20px 40px -22px rgba(58, 48, 82, 0.3));
}
.acct-menu[hidden] {
  display: none;
}
.acct-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px 9px;
  border-bottom: 1px solid var(--line-2, #f2eef7);
  margin-bottom: 7px;
}
.acct-head-name {
  font-size: var(--fs-sm, 12px);
  color: var(--text, #39343f);
}
.acct-head-mail {
  font-size: var(--fs-xs, 11px);
  color: var(--text-3, #9d97a9);
  word-break: break-all;
}
.acct-item,
.acct-logout {
  width: 100%;
  padding: 8px 9px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  font-family: inherit;
  font-size: var(--fs-sm, 12px);
  font-weight: 620;
  text-align: left;
  cursor: pointer;
}
.acct-item {
  color: var(--text, #39343f);
}
.acct-item:hover {
  background: var(--accent-soft, #efeaf9);
  color: var(--accent-ink, #6b57a6);
}
.acct-logout {
  color: var(--danger, #cf858f);
}
.acct-logout:hover {
  background: var(--danger-soft, #fbedf0);
}

.pwd-overlay {
  position: fixed;
  inset: 0;
  z-index: 240;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
  background: rgba(43, 36, 60, 0.28);
  backdrop-filter: blur(4px);
}
.pwd-dialog {
  width: 100%;
  max-width: 396px;
}
.pwd-actions {
  display: flex;
  gap: 8px;
  margin-top: 3px;
}
.pwd-cancel {
  flex: 0 0 auto;
  padding: 11px 14px;
  border: 1px solid var(--line, #ebe5f1);
  border-radius: 12px;
  background: var(--surface, #fff);
  color: var(--text-2, #6d687a);
  font-family: inherit;
  font-size: var(--fs, 13.5px);
  font-weight: 620;
  cursor: pointer;
}
.pwd-cancel:hover {
  background: var(--surface-2, #f6f3f9);
}
.pwd-actions .auth-submit {
  flex: 1 1 auto;
  margin-top: 0;
}

@media (max-width: 640px) {
  .acct-name,
  .acct-caret {
    display: none;
  }
  .acct-btn {
    padding: 4px;
  }
  .auth-card {
    padding: 22px 18px 18px;
    border-radius: 18px;
  }
}
